diff --git a/spring-boot-modules/spring-boot-properties-2/src/main/java/com/baeldung/properties/value/defaults/ValuesWithDefaultsApp.java b/spring-boot-modules/spring-boot-properties-2/src/main/java/com/baeldung/properties/value/defaults/ValuesWithDefaultsApp.java index 72fa0e03c0..2a2b535be7 100644 --- a/spring-boot-modules/spring-boot-properties-2/src/main/java/com/baeldung/properties/value/defaults/ValuesWithDefaultsApp.java +++ b/spring-boot-modules/spring-boot-properties-2/src/main/java/com/baeldung/properties/value/defaults/ValuesWithDefaultsApp.java @@ -51,21 +51,21 @@ public class ValuesWithDefaultsApp { @PostConstruct public void afterInitialize() { // strings - Assert.isTrue(stringWithDefaultValue.equals("my default value")); - Assert.isTrue(stringWithBlankDefaultValue.equals("")); + Assert.isTrue(stringWithDefaultValue.equals("my default value"), "unexpected value for stringWithDefaultValue"); + Assert.isTrue(stringWithBlankDefaultValue.equals(""), "unexpected value for stringWithBlankDefaultValue"); // other primitives - Assert.isTrue(booleanWithDefaultValue); - Assert.isTrue(intWithDefaultValue == 42); + Assert.isTrue(booleanWithDefaultValue, "unexpected value for booleanWithDefaultValue"); + Assert.isTrue(intWithDefaultValue == 42, "unexpected value for intWithDefaultValue"); // arrays List stringListValues = Arrays.asList("one", "two", "three"); - Assert.isTrue(Arrays.asList(stringArrayWithDefaults).containsAll(stringListValues)); + Assert.isTrue(Arrays.asList(stringArrayWithDefaults).containsAll(stringListValues), "unexpected value for stringArrayWithDefaults"); List intListValues = Arrays.asList(1, 2, 3); - Assert.isTrue(Arrays.asList(ArrayUtils.toObject(intArrayWithDefaults)).containsAll(intListValues)); + Assert.isTrue(Arrays.asList(ArrayUtils.toObject(intArrayWithDefaults)).containsAll(intListValues), "unexpected value for intArrayWithDefaults"); // SpEL - Assert.isTrue(spelWithDefaultValue.equals("my default system property value")); + Assert.isTrue(spelWithDefaultValue.equals("my default system property value"), "unexpected value for spelWithDefaultValue"); } } diff --git a/spring-boot-modules/spring-boot-properties-2/src/test/java/com/baeldung/properties/lists/ListsPropertiesUnitTest.java b/spring-boot-modules/spring-boot-properties-2/src/test/java/com/baeldung/properties/lists/ListsPropertiesUnitTest.java index 60ba4cc108..1abb643d75 100644 --- a/spring-boot-modules/spring-boot-properties-2/src/test/java/com/baeldung/properties/lists/ListsPropertiesUnitTest.java +++ b/spring-boot-modules/spring-boot-properties-2/src/test/java/com/baeldung/properties/lists/ListsPropertiesUnitTest.java @@ -13,6 +13,7 @@ import java.util.Collections; import java.util.List; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertArrayEquals; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = SpringListPropertiesApplication.class) @@ -47,7 +48,7 @@ public class ListsPropertiesUnitTest { @Test public void whenContextIsInitialized_thenInjectedArrayContainsExpectedValues() { - assertEquals(new String[] {"Baeldung", "dot", "com"}, arrayOfStrings); + assertArrayEquals(new String[] {"Baeldung", "dot", "com"}, arrayOfStrings); } @Test @@ -82,7 +83,7 @@ public class ListsPropertiesUnitTest { String[] arrayOfStrings = environment.getProperty("arrayOfStrings", String[].class); List listOfStrings = (List)environment.getProperty("arrayOfStrings", List.class); - assertEquals(new String[] {"Baeldung", "dot", "com"}, arrayOfStrings); + assertArrayEquals(new String[] {"Baeldung", "dot", "com"}, arrayOfStrings); assertEquals(Arrays.asList("Baeldung", "dot", "com"), listOfStrings); } }