From 8d07e8fab96ca4375ae21c953f904d74985b4164 Mon Sep 17 00:00:00 2001 From: Sebastian Luna Date: Wed, 2 Sep 2020 07:46:50 -0500 Subject: [PATCH 1/2] BAEL-4387 Change module --- .../ArrayToListConversionUnitTest.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) rename {java-collections-conversions-2 => core-java-modules/core-java-string-operations-3}/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java (61%) diff --git a/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java b/core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java similarity index 61% rename from java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java rename to core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java index 551661810d..80e7b93b0c 100644 --- a/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java +++ b/core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java @@ -1,21 +1,24 @@ package com.baeldung.arrayconversion; +import org.hamcrest.CoreMatchers; import org.junit.Test; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.assertArrayEquals; + public class ArrayToListConversionUnitTest { @Test(expected = UnsupportedOperationException.class) public void givenAnArray_whenConvertingToList_returnUnmodifiableListUnitTest() { String[] stringArray = new String[] { "A", "B", "C", "D" }; List stringList = Arrays.asList(stringArray); - System.out.println(stringList); stringList.set(0, "E"); - System.out.println(stringList); - System.out.println(Arrays.toString(stringArray)); + assertThat(stringList, CoreMatchers.hasItems("E", "B", "C", "D")); + assertArrayEquals(stringArray, new String[] { "E", "B", "C", "D" }); stringList.add("F"); } @@ -23,10 +26,10 @@ public class ArrayToListConversionUnitTest { public void givenAnArray_whenConvertingToList_returnModifiableListUnitTest() { String[] stringArray = new String[] { "A", "B", "C", "D" }; List stringList = new ArrayList<>(Arrays.asList(stringArray)); - System.out.println(stringList); stringList.set(0, "E"); - System.out.println(stringList); - System.out.println(Arrays.toString(stringArray)); + assertThat(stringList, CoreMatchers.hasItems("E", "B", "C", "D")); + assertArrayEquals(stringArray, new String[] { "A", "B", "C", "D" }); stringList.add("F"); + assertThat(stringList, CoreMatchers.hasItems("E", "B", "C", "D", "F")); } } From 53360080dbb38bc7ee81f6fff8e573f766b6ec66 Mon Sep 17 00:00:00 2001 From: Sebastian Luna Date: Thu, 3 Sep 2020 20:49:20 -0500 Subject: [PATCH 2/2] BAEL-4387 Change Module --- .../baeldung/arrayconversion/ArrayToListConversionUnitTest.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {core-java-modules/core-java-string-operations-3 => java-collections-conversions-2}/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java (100%) diff --git a/core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java b/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java similarity index 100% rename from core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java rename to java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java