### Question:
BaseBronKerboschCliqueFinder implements MaximalCliqueEnumerationAlgorithm<V, E> { @Override public Iterator<Set<V>> iterator() { lazyRun(); return allMaximalCliques.iterator(); } BaseBronKerboschCliqueFinder(Graph<V, E> graph, long timeout, TimeUnit unit); @Override Iterator<Set<V>> iterator(); Iterator<Set<V>> maximumIterator(); boolean isTimeLimitReached();  }### Answer:
@Test public void testFindAll() { SimpleGraph<String, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); createGraph(g); MaximalCliqueEnumerationAlgorithm<String, DefaultEdge> finder = createFinder1(g); Collection<Set<String>> cliques = new HashSet<>(); finder.iterator().forEachRemaining(cliques::add); assertEquals(5, cliques.size()); Set<Set<String>> expected = new HashSet<>(); Set<String> set = new HashSet<>(); set.add(V1); set.add(V2); set.add(V3); set.add(V4); expected.add(set); set = new HashSet<>(); set.add(V5); set.add(V6); set.add(V7); expected.add(set); set = new HashSet<>(); set.add(V3); set.add(V4); set.add(V5); expected.add(set); set = new HashSet<>(); set.add(V7); set.add(V8); expected.add(set); set = new HashSet<>(); set.add(V1); set.add(V2); set.add(V9); set.add(V10); expected.add(set); Set<Set<String>> actual = new HashSet<>(cliques); assertEquals(expected, actual); }
@Test(expected = IllegalArgumentException.class) public void testNonSimple() { Graph<String, DefaultEdge> g = new Pseudograph<>(DefaultEdge.class); g.addVertex("1"); g.addVertex("2"); g.addEdge("1", "2"); g.addEdge("1", "2"); MaximalCliqueEnumerationAlgorithm<String, DefaultEdge> finder = createFinder1(g); Iterator<Set<String>> it = finder.iterator(); while (it.hasNext()) { it.next(); } }
@Test public void testComplete() { final int size = 6; Graph<Object, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); CompleteGraphGenerator<Object, DefaultEdge> completeGraphGenerator = new CompleteGraphGenerator<>(size); completeGraphGenerator.generateGraph(g, new ClassBasedVertexFactory<>(Object.class), null); MaximalCliqueEnumerationAlgorithm<Object, DefaultEdge> finder = createFinder2(g); Set<Set<Object>> cliques = new HashSet<>(); finder.iterator().forEachRemaining(cliques::add); assertEquals(1, cliques.size()); cliques.stream().forEach(clique -> assertEquals(size, clique.size())); }