JAVA-8637: addressing PR review comments.
This commit is contained in:
parent
58e6087b3d
commit
6ae07978cd
@ -14,7 +14,7 @@ public class LambdaExceptionWrappers {
|
|||||||
try {
|
try {
|
||||||
consumer.accept(i);
|
consumer.accept(i);
|
||||||
} catch (ArithmeticException e) {
|
} 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) {
|
} catch (Exception ex) {
|
||||||
try {
|
try {
|
||||||
E exCast = clazz.cast(ex);
|
E exCast = clazz.cast(ex);
|
||||||
LOGGER.error("Exception occured : {}", exCast.getMessage());
|
LOGGER.error("Exception occurred.", exCast);
|
||||||
} catch (ClassCastException ccEx) {
|
} catch (ClassCastException ccEx) {
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ public class LambdaExceptionWrappers {
|
|||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
try {
|
try {
|
||||||
E exCast = exceptionClass.cast(ex);
|
E exCast = exceptionClass.cast(ex);
|
||||||
LOGGER.error("Exception occured : {}", exCast.getMessage());
|
LOGGER.error("Exception occurred.", exCast);
|
||||||
} catch (ClassCastException ccEx) {
|
} catch (ClassCastException ccEx) {
|
||||||
throw new RuntimeException(ex);
|
throw new RuntimeException(ex);
|
||||||
}
|
}
|
||||||
|
@ -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.javax.persistence.schema-generation.scripts.create-source=metadata
|
||||||
#spring.jpa.properties.hibernate.format_sql=true
|
#spring.jpa.properties.hibernate.format_sql=true
|
||||||
|
|
||||||
spring.jpa.show-sql=true
|
spring.jpa.show-sql=false
|
||||||
|
|
||||||
#hibernate.dialect=org.hibernate.dialect.H2Dialect
|
#hibernate.dialect=org.hibernate.dialect.H2Dialect
|
||||||
spring.jpa.properties.hibernate.id.new_generator_mappings=false
|
spring.jpa.properties.hibernate.id.new_generator_mappings=false
|
@ -10,7 +10,6 @@ import com.baeldung.boot.Application;
|
|||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(classes = Application.class)
|
@SpringBootTest(classes = Application.class)
|
||||||
@TestPropertySource(properties = {"spring.jpa.show-sql=false "})
|
|
||||||
public class SpringContextTest {
|
public class SpringContextTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -17,7 +17,6 @@ import com.baeldung.partialupdate.service.CustomerService;
|
|||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(classes = PartialUpdateApplication.class)
|
@SpringBootTest(classes = PartialUpdateApplication.class)
|
||||||
@TestPropertySource(properties = {"spring.jpa.show-sql=false "})
|
|
||||||
public class PartialUpdateUnitTest {
|
public class PartialUpdateUnitTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -25,8 +25,7 @@ public class SquareCalculatorUnitTest {
|
|||||||
@Test
|
@Test
|
||||||
public void whenCalculatingSquareValueOnce_thenCacheDontHaveValues() {
|
public void whenCalculatingSquareValueOnce_thenCacheDontHaveValues() {
|
||||||
for (int i = 10; i < 15; i++) {
|
for (int i = 10; i < 15; i++) {
|
||||||
assertFalse(cacheHelper.getSquareNumberCache()
|
assertFalse(cacheHelper.getSquareNumberCache().containsKey(i));
|
||||||
.containsKey(i));
|
|
||||||
LOGGER.debug("Square value of {} is: {}", i, squaredCalculator.getSquareValueOfNumber(i));
|
LOGGER.debug("Square value of {} is: {}", i, squaredCalculator.getSquareValueOfNumber(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -34,14 +33,12 @@ public class SquareCalculatorUnitTest {
|
|||||||
@Test
|
@Test
|
||||||
public void whenCalculatingSquareValueAgain_thenCacheHasAllValues() {
|
public void whenCalculatingSquareValueAgain_thenCacheHasAllValues() {
|
||||||
for (int i = 10; i < 15; i++) {
|
for (int i = 10; i < 15; i++) {
|
||||||
assertFalse(cacheHelper.getSquareNumberCache()
|
assertFalse(cacheHelper.getSquareNumberCache().containsKey(i));
|
||||||
.containsKey(i));
|
|
||||||
LOGGER.debug("Square value of {} is: {}", i, squaredCalculator.getSquareValueOfNumber(i));
|
LOGGER.debug("Square value of {} is: {}", i, squaredCalculator.getSquareValueOfNumber(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 10; i < 15; i++) {
|
for (int i = 10; i < 15; i++) {
|
||||||
assertTrue(cacheHelper.getSquareNumberCache()
|
assertTrue(cacheHelper.getSquareNumberCache().containsKey(i));
|
||||||
.containsKey(i));
|
|
||||||
LOGGER.debug("Square value of {} is: {}", i, squaredCalculator.getSquareValueOfNumber(i) + "\n");
|
LOGGER.debug("Square value of {} is: {}", i, squaredCalculator.getSquareValueOfNumber(i) + "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user