@Test(expected = UnsupportedOperationException.class) public void testRetainAll1() throws Exception { IntSet sis = new SingletonIntSet(3); IntSet sis2 = new SingletonIntSet(3); sis.retainAll(sis2); }
@Test(expected = UnsupportedOperationException.class) public void testRemove1() throws Exception { IntSet sis = new SingletonIntSet(3); sis.remove(Integer.valueOf(3)); }
@Test(expected = UnsupportedOperationException.class) public void testRemoveAll1() throws Exception { IntSet sis = new SingletonIntSet(3); Set<Integer> hashSet = new HashSet<>(); sis.removeAll(hashSet); }
@Test(expected = UnsupportedOperationException.class) public void testSet() throws Exception { IntSet sis = new SingletonIntSet(3); sis.set(1); }
@Test(expected = UnsupportedOperationException.class) public void testClear() throws Exception { IntSet sis = new SingletonIntSet(3); sis.clear(); }
@Test(expected = UnsupportedOperationException.class) public void testRemoveIfPrimitive() { IntSet sis = new SingletonIntSet(3); sis.removeIf((int i) -> i == 3); }
@Test(expected = UnsupportedOperationException.class) public void testAdd() throws Exception { IntSet sis = new SingletonIntSet(3); sis.add(1); }
@Test public void testForEachPrimitive() { IntSet sis = new SingletonIntSet(3); Set<Integer> results = new HashSet<>(); sis.forEach((IntConsumer) results::add); assertEquals(1, results.size()); assertTrue(results.contains(3)); }
@Test public void testIntSpliteratorForEachRemaining() { IntSet sis = new SingletonIntSet(3); Set<Integer> results = new HashSet<>(); sis.intSpliterator().forEachRemaining((IntConsumer) results::add); assertEquals(1, results.size()); assertTrue(results.contains(3)); }
@Test(expected = UnsupportedOperationException.class) public void testAddAll2() throws Exception { Set<Integer> hashSet = CollectionFactory.makeSet(1, 4); IntSet sis = new SingletonIntSet(3); sis.addAll(hashSet); }
@Test(expected = UnsupportedOperationException.class) public void testAddAll1() throws Exception { IntSet sis = new SingletonIntSet(3); SmallIntSet sis2 = new SmallIntSet(); sis.addAll(sis2); }
@Test public void testEquals() throws Exception { IntSet sis = new SingletonIntSet(3); IntSet sis2 = new SingletonIntSet(4); // Verify equals both ways assertNotEquals(sis, sis2); assertNotEquals(sis2, sis); IntSet sis3 = SmallIntSet.of(3); assertEquals(sis3, sis); assertEquals(sis, sis3); }
@Test public void testToIntArray() throws Exception { IntSet sis = new SingletonIntSet(3); int[] array = sis.toIntArray(); assertArrayEquals(new int[]{3}, array); }
@Test public void testIntStream() throws Exception { IntSet sis = new SingletonIntSet(3); assertEquals(1, sis.intStream().count()); }
@Test public void testToArray() throws Exception { IntSet sis = new SingletonIntSet(3); Object[] array = sis.toArray(); assertEquals(1, array.length); assertEquals(3, array[0]); }
@Test public void testToArray1() throws Exception { IntSet sis = new SingletonIntSet(3); Object[] array = sis.toArray(new Integer[1]); assertEquals(1, array.length); assertEquals(3, array[0]); }
@Test public void testContains() throws Exception { IntSet sis = new SingletonIntSet(3); assertFalse(sis.contains(5)); assertTrue(sis.contains(3)); }
@Test public void testIterator() throws Exception { IntSet sis = new SingletonIntSet(3); PrimitiveIterator.OfInt iterator = sis.iterator(); assertEquals(3, iterator.nextInt()); assertFalse(iterator.hasNext()); }
@Test public void testEquals() throws Exception { IntSet sis2 = new SingletonIntSet(4); // Verify equals both ways assertNotEquals(es, sis2); assertNotEquals(sis2, es); // This is empty, just sets the range IntSet sis3 = new SmallIntSet(2); assertEquals(sis3, es); assertEquals(es, sis3); }
@Test public void testContainsAll() throws Exception { IntSet sis2 = new SingletonIntSet(3); assertFalse(es.containsAll(sis2)); assertTrue(sis2.containsAll(es)); IntSet sis3 = new RangeSet(0); assertTrue(sis3.containsAll(es)); assertTrue(es.containsAll(sis3)); }