@Test public void getReturnsCorrectPrecipices() { Integer[] indices = {0, 1, 2}; SingleReaderArrayIterable iterable = getIterable(indices); when(strategy.nextIndices()).thenReturn(iterable); when(guardRail1.acquirePermits(1L, nanoTime)).thenReturn(null); when(guardRail2.acquirePermits(1L, nanoTime)).thenReturn(null); Sequence<Precipice<TimeoutableResult, Rejected>> all = pattern.getPrecipices(1L, nanoTime); List<Precipice<TimeoutableResult, Rejected>> controllableList = new ArrayList<>(); for (Precipice<TimeoutableResult, Rejected> item : all) { controllableList.add(item); } verifyZeroInteractions(precipice3); verifyZeroInteractions(guardRail3); assertEquals(2, controllableList.size()); assertSame(precipice1, controllableList.get(0)); assertSame(precipice2, controllableList.get(1)); }
public Sequence<C> getPrecipices(long permits) { return getPrecipices(permits, System.nanoTime()); }
Pattern { public Sequence<C> getPrecipices(long permits) { return getPrecipices(permits, System.nanoTime()); } }
Pattern { public Sequence<C> getPrecipices(long permits) { return getPrecipices(permits, System.nanoTime()); } Pattern(Collection<C> precipices, PatternStrategy strategy);  Pattern(Collection<C> precipices, PatternStrategy strategy, SequenceFactory<C> sequenceFactory); }
Pattern { public Sequence<C> getPrecipices(long permits) { return getPrecipices(permits, System.nanoTime()); } Pattern(Collection<C> precipices, PatternStrategy strategy);  Pattern(Collection<C> precipices, PatternStrategy strategy, SequenceFactory<C> sequenceFactory); Sequence<C> getPrecipices(long permits); Sequence<C> getPrecipices(long permits, long nanoTime); List<C> getAllPrecipices(); }
Pattern { public Sequence<C> getPrecipices(long permits) { return getPrecipices(permits, System.nanoTime()); } Pattern(Collection<C> precipices, PatternStrategy strategy);  Pattern(Collection<C> precipices, PatternStrategy strategy, SequenceFactory<C> sequenceFactory); Sequence<C> getPrecipices(long permits); Sequence<C> getPrecipices(long permits, long nanoTime); List<C> getAllPrecipices();  }