@SuppressWarnings("unchecked") // varargs! public void testCartesianProductTooBig() { Set<Integer> set = ContiguousSet.create(Range.closed(0, 10000), DiscreteDomain.integers()); try { Sets.cartesianProduct(set, set, set, set, set); fail("Expected IAE"); } catch (IllegalArgumentException expected) { } }
@Test public void whenCreateRangeOfIntegersSet_thenCreated() { final int start = 10; final int end = 30; final ContiguousSet<Integer> set = ContiguousSet.create(Range.closed(start, end), DiscreteDomain.integers()); assertEquals(21, set.size()); assertEquals(10, set.first().intValue()); assertEquals(30, set.last().intValue()); }