### Question:
AggregateTaskDataSource extends TaskDataSource { @Nullable @Override public Bundle peek() { while (requireValidSource()) { Bundle peek = currentSource.peek(); log.debug("peek {}", peek); if (peek != null) { return peek; } resetCurrentSource(); } return null; }  @Override void init(); @Override void close(); @Nullable @Override Bundle next(); @Nullable @Override Bundle peek(); @Nonnull @Override ImmutableList<Path> writableRootPaths();  }### Answer:
@Test public void testPeek() throws Exception { AggregateTaskDataSource aggregateTaskDataSource = new AggregateTaskDataSource(); TaskDataSource mockDS1 = Mockito.mock(TaskDataSource.class); TaskDataSource mockDS2 = Mockito.mock(TaskDataSource.class); aggregateTaskDataSource.setSources(new TaskDataSource[]{mockDS1, mockDS2}); mockDS1.init(); mockDS2.init(); Mockito.when(mockDS1.isEnabled()).thenReturn(true); Mockito.when(mockDS2.isEnabled()).thenReturn(true); Mockito.when(mockDS1.peek()).thenReturn(null); Mockito.when(mockDS2.peek()).thenReturn(null); aggregateTaskDataSource.init(); aggregateTaskDataSource.peek(); Mockito.verify(mockDS1).peek(); Mockito.verify(mockDS2).peek(); }