### Question:
AutoPropertyBuilder implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { Object specimen = this.builder.create(request, context); if(this.specification.isSatisfiedBy(request)) command.execute(request, specimen, context); return specimen; } AutoPropertyBuilder(SpecimenBuilder builder, BehaviourCommand command, Specification specification); @Override Object create(Object request, SpecimenContext context); Specification specification();  }### Answer:
@Test public void does_not_call_execute_on_command_if_specification_is_noy_satisfied() { when(this.mockBuilder.create(request, mockContext)).thenReturn(expectedSpecimen); when(this.mockSpecification.isSatisfiedBy(request)).thenReturn(false); this.autoPropertyBuilder.create(this.request, this.mockContext); verify(this.mockCommand, never()).execute(this.request, this.expectedSpecimen, this.mockContext); }
@Test public void create_method_returns_the_specimen_creator_by_the_builder() { when(this.mockBuilder.create(request, mockContext)).thenReturn(expectedSpecimen); Object createdSpecimen = this.autoPropertyBuilder.create(this.request, this.mockContext); assertSame(expectedSpecimen, createdSpecimen); }
@Test public void calls_execute_on_command_if_specification_is_satisfied() { when(this.mockBuilder.create(request, mockContext)).thenReturn(expectedSpecimen); when(this.mockSpecification.isSatisfiedBy(request)).thenReturn(true); this.autoPropertyBuilder.create(this.request, this.mockContext); verify(this.mockCommand).execute(this.request, this.expectedSpecimen, this.mockContext); }