/** Test of intersection method, of class Set. */ @Test public void testIntersection() { Set<Integer> set1 = new Set<Integer>(); Set<Integer> set2 = new Set<Integer>(); set1.addElement(1); set1.addElement(2); set2.addElement(2); set2.addElement(3); assertTrue(set1.intersection(set2).elementExists(2)); assertFalse(set1.intersection(set2).elementExists(3)); }
@Test public void testIntersection() throws Exception { PCollection<String> intersection = Set.intersection(set1, set2); assertEquals(Lists.newArrayList("a", "c"), Lists.newArrayList(intersection.materialize())); }