### Question:
FirstWorkingReporter implements Reporter { @Override public boolean canApprove(File fileForApproval) { for (Reporter other : others) { if (other.canApprove(fileForApproval)) { return true; } } return false; } FirstWorkingReporter(Reporter... others); @Override void notTheSame(byte[] oldValue, File fileForVerification, byte[] newValue, File fileForApproval); @Override void approveNew(byte[] value, File fileForApproval, File fileForVerification); @Override boolean canApprove(File fileForApproval);  }### Answer:
@Test public void shouldCallCanApproveUntilItFindsAValidOne() throws Exception { when(second.canApprove(Mockito.any(File.class))).thenReturn(true); when(third.canApprove(Mockito.any(File.class))).thenReturn(true); final boolean canApprove = new FirstWorkingReporter(first, second, third).canApprove(null); assertThat(canApprove, is(true)); verify(first, times(1)).canApprove(null); verify(second, times(1)).canApprove(null); verify(third, never()).canApprove(null); }
@Test public void shouldReturnFalseFromCannApproveIfNooneCannApprove() throws Exception { final boolean canApprove = new FirstWorkingReporter(first, second, third).canApprove(null); assertThat(canApprove, is(false)); }