@Test public void field_request_returns_context_result_of_field_type() throws NoSuchFieldException { when(mockSpecimenContext.resolve(any(SeededRequest.class))).thenReturn(1); Object result = this.fieldBuilder.create(getIntField(), mockSpecimenContext); assertEquals(1, result); }
@Override public Object create(Object request, SpecimenContext context) { if (!(request instanceof Field)) { return new NoSpecimen(); } Field field = (Field) request; Type genericType = field.getGenericType(); SpecimenType specimenType = SpecimenType.of(genericType); String fieldName = field.getName(); Object actualRequest = getActualRequest(field, specimenType); return context.resolve(new SeededRequest(fieldName, actualRequest)); }
FieldRelay implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (!(request instanceof Field)) { return new NoSpecimen(); } Field field = (Field) request; Type genericType = field.getGenericType(); SpecimenType specimenType = SpecimenType.of(genericType); String fieldName = field.getName(); Object actualRequest = getActualRequest(field, specimenType); return context.resolve(new SeededRequest(fieldName, actualRequest)); } }
FieldRelay implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (!(request instanceof Field)) { return new NoSpecimen(); } Field field = (Field) request; Type genericType = field.getGenericType(); SpecimenType specimenType = SpecimenType.of(genericType); String fieldName = field.getName(); Object actualRequest = getActualRequest(field, specimenType); return context.resolve(new SeededRequest(fieldName, actualRequest)); } FieldRelay(RequestEnricher requestEnricher); }
FieldRelay implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (!(request instanceof Field)) { return new NoSpecimen(); } Field field = (Field) request; Type genericType = field.getGenericType(); SpecimenType specimenType = SpecimenType.of(genericType); String fieldName = field.getName(); Object actualRequest = getActualRequest(field, specimenType); return context.resolve(new SeededRequest(fieldName, actualRequest)); } FieldRelay(RequestEnricher requestEnricher); @Override Object create(Object request, SpecimenContext context); }
FieldRelay implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (!(request instanceof Field)) { return new NoSpecimen(); } Field field = (Field) request; Type genericType = field.getGenericType(); SpecimenType specimenType = SpecimenType.of(genericType); String fieldName = field.getName(); Object actualRequest = getActualRequest(field, specimenType); return context.resolve(new SeededRequest(fieldName, actualRequest)); } FieldRelay(RequestEnricher requestEnricher); @Override Object create(Object request, SpecimenContext context);  }