// Variant of SetTheoryTest example import org.junit.*; import org.junit.runner.RunWith; import static org.junit.Assert.*; import static org.junit.Assume.*; import org.junit.experimental.theories.DataPoint; import org.junit.experimental.theories.DataPoints; import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theory; import java.util.*; @RunWith(Theories.class) public class ListTheoryTest { @DataPoints public static String[] string = {"ant", "bat", "cat"}; @DataPoints public static List[] sets = { new ArrayList(Arrays.asList("ant", "bat")), new ArrayList(Arrays.asList("bat", "cat", "dog", "elk")), new ArrayList(Arrays.asList("Snap", "Crackle", "Pop")) }; @Theory public void removeThenAddDoesNotChangeList( List set, E string) { // Parameters! assumeTrue(set.contains(string)); // Assume List copy = new ArrayList(set); // Act copy.remove(string); copy.add(string); System.out.println("List, string: " + set + ", " + string); assertTrue (set.contains(string)); // Assert //assertTrue (set.equals(copy)); // Assert } }