diff --git a/core-java/src/test/java/org/baeldung/java/CollectionsJoinAndSplitJUnitTest.java b/core-java/src/test/java/org/baeldung/java/CollectionsJoinAndSplitJUnitTest.java deleted file mode 100644 index 9d7b306c1f..0000000000 --- a/core-java/src/test/java/org/baeldung/java/CollectionsJoinAndSplitJUnitTest.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.baeldung.java.collections; - -import java.util.ArrayList; - -import org.junit.Assert; -import org.junit.Test; - - -//import java.util.AbstractSet; - -public class CollectionsJoinAndSplitJUnitTest { - - public ArrayList sauces = new ArrayList(); - public ArrayList cheeses = new ArrayList(); - public ArrayList vegetables = new ArrayList(); - - public ArrayList> ingredients = new ArrayList>(); - - public CollectionsJoinAndSplitJUnitTest() throws Exception { - //generate test data - whenGeneratingTestData_ShouldSucceed(); - } - - @Test - public void whenGeneratingTestData_ShouldSucceed() throws Exception { - sauces.clear(); - sauces.add("Olive Oil"); - sauces.add("Marinara"); - - cheeses.clear(); - cheeses.add("Mozarella"); - cheeses.add("Feta"); - cheeses.add("Parmesan"); - - vegetables.clear(); - vegetables.add("Olives"); - vegetables.add("Spinach"); - vegetables.add("Green Peppers"); - - ingredients.clear(); - ingredients.add(sauces); - ingredients.add(cheeses); - ingredients.add(vegetables); - - Assert.assertTrue(sauces.size() == 2); - Assert.assertTrue(cheeses.size() == 3); - Assert.assertTrue(vegetables.size() == 3); - Assert.assertTrue(ingredients.size() == 3); - } - - @Test - public void givenThreeArrayLists_whenJoiningIntoOneArrayList_ShouldSucceed() throws Exception { - ArrayList> toppings = new ArrayList>(); - - toppings.add(sauces); - toppings.add(cheeses); - toppings.add(vegetables); - - Assert.assertTrue(toppings.size() == 3); - Assert.assertTrue(toppings.contains(sauces)); - Assert.assertTrue(toppings.contains(cheeses)); - Assert.assertTrue(toppings.contains(vegetables)); - } - - @Test - public void givenOneArrayList_whenSplittingIntoTwoArrayLists_shouldSucceed() throws Exception { - ArrayList> toppings = ingredients; - ArrayList> removedToppings = new ArrayList>(); - - removedToppings.add(toppings.remove(toppings.indexOf(vegetables))); - - Assert.assertTrue(removedToppings.contains(vegetables)); - Assert.assertTrue(removedToppings.size() == 1); - Assert.assertTrue(toppings.size() == 2); - Assert.assertTrue(toppings.contains(sauces)); - Assert.assertTrue(toppings.contains(cheeses)); - } -}