Fixed most reported issues by SonarCloud.

This commit is contained in:
Toxic Dreamz
2020-08-15 21:47:39 +04:00
parent e7e3ace01f
commit 31471acb69
190 changed files with 1426 additions and 661 deletions

View File

@ -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);
}
}

View File

@ -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[]{}));
}
}