@Test public void testApprove() throws Exception { ComplexIdentifiableContentApprover complexApprover = new ComplexIdentifiableContentApprover( approver1, approver2); doReturn(true).when(approver1).approve(id, content); doReturn(true).when(approver2).approve(id, content); boolean result = complexApprover.approve(id, content); assertTrue(result); verify(approver1).approve(approver1IdCaptor.capture(), approver1ContentCaptor.capture()); verify(approver2).approve(approver2IdCaptor.capture(), approver2ContentCaptor.capture()); assertTrue(content == approver1ContentCaptor.getValue()); assertTrue(content == approver2ContentCaptor.getValue()); assertTrue(id == approver1IdCaptor.getValue()); assertTrue(id == approver2IdCaptor.getValue()); }
@Override public boolean approve(String id, byte[] content) { for (IdentifiableContentApprover currentApprover : approvers) { if (!currentApprover.approve(id, content)) { return false; } } return true; }
ComplexIdentifiableContentApprover implements IdentifiableContentApprover { @Override public boolean approve(String id, byte[] content) { for (IdentifiableContentApprover currentApprover : approvers) { if (!currentApprover.approve(id, content)) { return false; } } return true; } }
ComplexIdentifiableContentApprover implements IdentifiableContentApprover { @Override public boolean approve(String id, byte[] content) { for (IdentifiableContentApprover currentApprover : approvers) { if (!currentApprover.approve(id, content)) { return false; } } return true; } ComplexIdentifiableContentApprover(List<IdentifiableContentApprover> approvers);  ComplexIdentifiableContentApprover(IdentifiableContentApprover... approvers); }
ComplexIdentifiableContentApprover implements IdentifiableContentApprover { @Override public boolean approve(String id, byte[] content) { for (IdentifiableContentApprover currentApprover : approvers) { if (!currentApprover.approve(id, content)) { return false; } } return true; } ComplexIdentifiableContentApprover(List<IdentifiableContentApprover> approvers);  ComplexIdentifiableContentApprover(IdentifiableContentApprover... approvers); @Override boolean approve(String id, byte[] content); }
ComplexIdentifiableContentApprover implements IdentifiableContentApprover { @Override public boolean approve(String id, byte[] content) { for (IdentifiableContentApprover currentApprover : approvers) { if (!currentApprover.approve(id, content)) { return false; } } return true; } ComplexIdentifiableContentApprover(List<IdentifiableContentApprover> approvers);  ComplexIdentifiableContentApprover(IdentifiableContentApprover... approvers); @Override boolean approve(String id, byte[] content);  }