Fixed most reported issues by SonarCloud.
This commit is contained in:
@ -34,9 +34,10 @@ import org.slf4j.LoggerFactory;
|
||||
public class NewSource {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(NewSource.class);
|
||||
private static final String VERSION = "2.0";
|
||||
public static final String SOURCE_MODULE = "Source module {}";
|
||||
|
||||
public int accumulateSum(int... nums) {
|
||||
LOGGER.info("Source module {}", VERSION);
|
||||
LOGGER.info(SOURCE_MODULE, VERSION);
|
||||
return Arrays.stream(nums).reduce(0, Integer::sum);
|
||||
}
|
||||
|
||||
@ -45,12 +46,12 @@ public class NewSource {
|
||||
* Replace old one in {@link OldSource}
|
||||
*/
|
||||
public int accumulateMul(int... nums) {
|
||||
LOGGER.info("Source module {}", VERSION);
|
||||
LOGGER.info(SOURCE_MODULE, VERSION);
|
||||
return Arrays.stream(nums).reduce(1, (a, b) -> a * b);
|
||||
}
|
||||
|
||||
public boolean ifNonZero(int... nums) {
|
||||
LOGGER.info("Source module {}", VERSION);
|
||||
LOGGER.info(SOURCE_MODULE, VERSION);
|
||||
return Arrays.stream(nums).allMatch(num -> num != 0);
|
||||
}
|
||||
}
|
||||
|
@ -25,12 +25,15 @@ package com.iluwatar.strangler;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
|
||||
/**
|
||||
* Application test
|
||||
*/
|
||||
public class AppTest {
|
||||
class AppTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
App.main(new String[]{});
|
||||
void shouldExecuteWithoutException() {
|
||||
assertDoesNotThrow(() -> App.main(new String[]{}));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user