@Test public void test() { Collection<ClientProcessor> delegate = new ArrayList<>(); EventProcessorInfo blue = EventProcessorInfo.newBuilder().setProcessorName("Blue").build(); EventProcessorInfo green = EventProcessorInfo.newBuilder().setProcessorName("Green").build(); EventProcessorInfo red = EventProcessorInfo.newBuilder().setProcessorName("Red").build(); EventProcessorInfo yellow = EventProcessorInfo.newBuilder().setProcessorName("Yellow").build(); EventProcessorInfo black = EventProcessorInfo.newBuilder().setProcessorName("Black").build(); delegate.add(new FakeClientProcessor("clientA", true, Topology.DEFAULT_CONTEXT, blue)); delegate.add(new FakeClientProcessor("clientA", true, Topology.DEFAULT_CONTEXT, green)); delegate.add(new FakeClientProcessor("clientA", true, Topology.DEFAULT_CONTEXT, red)); delegate.add(new FakeClientProcessor("clientB", true, Topology.DEFAULT_CONTEXT, blue)); delegate.add(new FakeClientProcessor("clientB", true, Topology.DEFAULT_CONTEXT, yellow)); delegate.add(new FakeClientProcessor("clientC", false, Topology.DEFAULT_CONTEXT, green)); delegate.add(new FakeClientProcessor("clientC", false, Topology.DEFAULT_CONTEXT, yellow)); delegate.add(new FakeClientProcessor("clientC", false, Topology.DEFAULT_CONTEXT, black)); delegate.add(new FakeClientProcessor("clientD", false, Topology.DEFAULT_CONTEXT, green)); delegate.add(new FakeClientProcessor("clientD", false, Topology.DEFAULT_CONTEXT, blue)); ProcessorNames testSubject = new ProcessorNames(delegate); Iterator<String> iterator = testSubject.iterator(); assertEquals(blue.getProcessorName(), iterator.next()); assertEquals(green.getProcessorName(), iterator.next()); assertEquals(red.getProcessorName(), iterator.next()); assertEquals(blue.getProcessorName(), iterator.next()); assertEquals(yellow.getProcessorName(), iterator.next()); assertEquals(green.getProcessorName(), iterator.next()); assertEquals(yellow.getProcessorName(), iterator.next()); assertEquals(black.getProcessorName(), iterator.next()); assertEquals(green.getProcessorName(), iterator.next()); assertEquals(blue.getProcessorName(), iterator.next()); assertFalse(iterator.hasNext()); }
@NotNull @Override public Iterator<String> iterator() { Iterator<ClientProcessor> iterator = clientProcessors.iterator(); return new Iterator<String>() { @Override public boolean hasNext() { return iterator.hasNext(); } @Override public String next() { return iterator.next().eventProcessorInfo().getProcessorName(); } }; }
ProcessorNames implements Iterable<String> { @NotNull @Override public Iterator<String> iterator() { Iterator<ClientProcessor> iterator = clientProcessors.iterator(); return new Iterator<String>() { @Override public boolean hasNext() { return iterator.hasNext(); } @Override public String next() { return iterator.next().eventProcessorInfo().getProcessorName(); } }; } }
ProcessorNames implements Iterable<String> { @NotNull @Override public Iterator<String> iterator() { Iterator<ClientProcessor> iterator = clientProcessors.iterator(); return new Iterator<String>() { @Override public boolean hasNext() { return iterator.hasNext(); } @Override public String next() { return iterator.next().eventProcessorInfo().getProcessorName(); } }; } ProcessorNames(Iterable<ClientProcessor> clientProcessors); }
ProcessorNames implements Iterable<String> { @NotNull @Override public Iterator<String> iterator() { Iterator<ClientProcessor> iterator = clientProcessors.iterator(); return new Iterator<String>() { @Override public boolean hasNext() { return iterator.hasNext(); } @Override public String next() { return iterator.next().eventProcessorInfo().getProcessorName(); } }; } ProcessorNames(Iterable<ClientProcessor> clientProcessors); @NotNull @Override Iterator<String> iterator(); }
ProcessorNames implements Iterable<String> { @NotNull @Override public Iterator<String> iterator() { Iterator<ClientProcessor> iterator = clientProcessors.iterator(); return new Iterator<String>() { @Override public boolean hasNext() { return iterator.hasNext(); } @Override public String next() { return iterator.next().eventProcessorInfo().getProcessorName(); } }; } ProcessorNames(Iterable<ClientProcessor> clientProcessors); @NotNull @Override Iterator<String> iterator();  }