This commit is contained in:
Loredana
2019-05-25 15:09:28 +03:00
52 changed files with 839 additions and 1680 deletions

View File

@@ -4,6 +4,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ResourceBundle;
import java.text.MessageFormat;
public class Slf4jLogger implements System.Logger {
@@ -74,28 +75,29 @@ public class Slf4jLogger implements System.Logger {
if (!isLoggable(level)) {
return;
}
String message = MessageFormat.format (format, params);
String message = MessageFormat.format(format, params);
switch (level) {
case TRACE:
logger.trace(format, params);
logger.trace(message);
break;
case DEBUG:
logger.debug(format, params);
logger.debug(message);
break;
case INFO:
logger.info(format, params);
logger.info(message);
break;
case WARNING:
logger.warn(format, params);
logger.warn(message);
break;
case ERROR:
logger.error(format, params);
logger.error(message);
break;
case ALL:
default:
logger.info(format, params);
logger.info(message);
}
}
}

View File

@@ -36,7 +36,7 @@ public class NumberFormatExceptionUnitTest {
@Test(expected = NumberFormatException.class)
public void givenParseIntMethod_whenUnderscoreInInput_thenFail() {
int bIntPrim = Integer.parseInt("6_000");
int bIntPrim = Integer.parseInt("_6000");
}
@Test(expected = NumberFormatException.class)
@@ -51,7 +51,7 @@ public class NumberFormatExceptionUnitTest {
@Test(expected = NumberFormatException.class)
public void givenDecodeMethod_whenAlphabetInInput_thenFail() {
Long decodeInteger = Long.decode("64403L");
Long decodedLong = Long.decode("64403L");
}
/* ---INTEGER PASS CASES--- */
@@ -72,7 +72,7 @@ public class NumberFormatExceptionUnitTest {
int aIntPrim = Integer.parseInt("6000 ".trim());
assertEquals(6000, aIntPrim);
int bIntPrim = Integer.parseInt("6_000".replaceAll("_", ""));
int bIntPrim = Integer.parseInt("_6000".replaceAll("_", ""));
assertEquals(6000, bIntPrim);
int cIntPrim = Integer.parseInt("-6000");

View File

@@ -0,0 +1,3 @@
### Relevant Articles
- [Why Do Local Variables Used in Lambdas Have to Be Final or Effectively Final?](https://www.baeldung.com/java-lambda-effectively-final-local-variables)