@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); }
@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 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 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); }
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(); }
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();  }