MCPcopy Create free account
hub / github.com/PCGen/pcgen / ListSetTest

Class ListSetTest

PCGen-base/code/src/test/pcgen/base/util/ListSetTest.java:40–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38import pcgen.testsupport.TestSupport;
39
40public class ListSetTest
41{
42
43 private ListSet<Integer> ls, ls2, ls3, ls4;
44
45 private Comparator<Integer> c = (arg0, arg1) ->
46 {
47 if (arg0 == arg1)
48 {
49 return 0;
50 }
51 int comp = arg0.compareTo(arg1);
52 if (comp != 0)
53 {
54 return comp;
55 }
56 if (System.identityHashCode(arg0) < System.identityHashCode(arg1))
57 {
58 return -1;
59 }
60 return 1;
61 };
62
63 @BeforeEach
64 void setUp()
65 {
66 ls = new ListSet<>();
67 ls2 = new ListSet<>(15);
68 ls3 = new ListSet<>(c);
69 ls4 = new ListSet<>(14, c);
70 }
71
72 @AfterEach
73 void tearDown()
74 {
75 ls = null;
76 ls2 = null;
77 ls3 = null;
78 ls4 = null;
79 }
80
81
82 @Test
83 public void testArchitecture()
84 {
85 assertFalse(ls instanceof List, "ListSet must not implement List, "
86 + "as it does not always return true to add(), "
87 + "as defined by the List interface");
88 }
89
90 @Test
91 public void testSize()
92 {
93 testSetSize(ls);
94 testSetSize(ls2);
95 testSetSize(ls3);
96 testSetSize(ls4);
97 }

Callers

nothing calls this directly

Calls 1

compareToMethod · 0.45

Tested by

no test coverage detected