### Question:
AllSatisfiedCompositePropertySpecification implements Specification { @Override public boolean isSatisfiedBy(Object request) { for(Specification specification : this.specifications) { if(!specification.isSatisfiedBy(request)) return false; } return true; } AllSatisfiedCompositePropertySpecification(Specification... specifications);  AllSatisfiedCompositePropertySpecification(Iterable<Specification> specifications); @Override boolean isSatisfiedBy(Object request);  }### Answer:
@Test public void returns_true_if_all_specifications_are_satisfied() { when(mockSpec1.isSatisfiedBy(this.request)).thenReturn(true); when(mockSpec2.isSatisfiedBy(this.request)).thenReturn(true); boolean isSatisfied = this.compositeSpecification.isSatisfiedBy(this.request); assertTrue(isSatisfied); }
@Test public void returns_false_if_any_specifications_are_not_satisfied() { when(mockSpec1.isSatisfiedBy(this.request)).thenReturn(true); when(mockSpec2.isSatisfiedBy(this.request)).thenReturn(false); boolean isSatisfied = this.compositeSpecification.isSatisfiedBy(this.request); assertFalse(isSatisfied); }