JAVA-8637: addressing PR review comments.

This commit is contained in:
chaos2418 2021-11-23 09:14:57 +05:30
parent 58e6087b3d
commit 6ae07978cd
5 changed files with 7 additions and 12 deletions

View File

@ -14,7 +14,7 @@ public class LambdaExceptionWrappers {
try {
consumer.accept(i);
} catch (ArithmeticException e) {
LOGGER.error("Arithmetic Exception occured : {}", e.getMessage());
LOGGER.error("Arithmetic Exception occurred.", e);
}
};
}
@ -26,7 +26,7 @@ public class LambdaExceptionWrappers {
} catch (Exception ex) {
try {
E exCast = clazz.cast(ex);
LOGGER.error("Exception occured : {}", exCast.getMessage());
LOGGER.error("Exception occurred.", exCast);
} catch (ClassCastException ccEx) {
throw ex;
}
@ -51,7 +51,7 @@ public class LambdaExceptionWrappers {
} catch (Exception ex) {
try {
E exCast = exceptionClass.cast(ex);
LOGGER.error("Exception occured : {}", exCast.getMessage());
LOGGER.error("Exception occurred.", exCast);
} catch (ClassCastException ccEx) {
throw new RuntimeException(ex);
}

View File

@ -9,7 +9,7 @@ spring.datasource.url=jdbc:h2:mem:baeldung
#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-source=metadata
#spring.jpa.properties.hibernate.format_sql=true
spring.jpa.show-sql=true
spring.jpa.show-sql=false
#hibernate.dialect=org.hibernate.dialect.H2Dialect
spring.jpa.properties.hibernate.id.new_generator_mappings=false

View File

@ -10,7 +10,6 @@ import com.baeldung.boot.Application;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
@TestPropertySource(properties = {"spring.jpa.show-sql=false "})
public class SpringContextTest {
@Test

View File

@ -17,7 +17,6 @@ import com.baeldung.partialupdate.service.CustomerService;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = PartialUpdateApplication.class)
@TestPropertySource(properties = {"spring.jpa.show-sql=false "})
public class PartialUpdateUnitTest {
@Autowired

View File

@ -25,8 +25,7 @@ public class SquareCalculatorUnitTest {
@Test
public void whenCalculatingSquareValueOnce_thenCacheDontHaveValues() {
for (int i = 10; i < 15; i++) {
assertFalse(cacheHelper.getSquareNumberCache()
.containsKey(i));
assertFalse(cacheHelper.getSquareNumberCache().containsKey(i));
LOGGER.debug("Square value of {} is: {}", i, squaredCalculator.getSquareValueOfNumber(i));
}
}
@ -34,14 +33,12 @@ public class SquareCalculatorUnitTest {
@Test
public void whenCalculatingSquareValueAgain_thenCacheHasAllValues() {
for (int i = 10; i < 15; i++) {
assertFalse(cacheHelper.getSquareNumberCache()
.containsKey(i));
assertFalse(cacheHelper.getSquareNumberCache().containsKey(i));
LOGGER.debug("Square value of {} is: {}", i, squaredCalculator.getSquareValueOfNumber(i));
}
for (int i = 10; i < 15; i++) {
assertTrue(cacheHelper.getSquareNumberCache()
.containsKey(i));
assertTrue(cacheHelper.getSquareNumberCache().containsKey(i));
LOGGER.debug("Square value of {} is: {}", i, squaredCalculator.getSquareValueOfNumber(i) + "\n");
}
}