### Question:
ElementFromListRelay implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (!(request instanceof ElementFromListRequest)) { return new NoSpecimen(); } ElementFromListRequest listRequest = (ElementFromListRequest) request; if (listRequest.getList().isEmpty()) { throw new ObjectCreationException("List of elements was empty"); } return this.strategy.get(listRequest.getList()); } ElementFromListRelay(ElementFromListStrategy strategy); @Override Object create(Object request, SpecimenContext context);  }### Answer:
@Test public void Non_element_from_list_request_returns_no_specimen() { Object result = this.relay.create("string", null); assertEquals(new NoSpecimen(), result); }
@Test(expected = ObjectCreationException.class) public void Empty_list_request_throws_exception() { this.relay.create(new ElementFromListRequest(new ArrayList<Object>()), null); }
@Test public void Element_from_list_request_returns_result_of_picking_strategy() { List<Object> list = new ArrayList<Object>(); list.add(new Object()); ElementFromListRequest request = new ElementFromListRequest(list); Object specimen = new Object(); when(this.mockElementStrategy.get(list)).thenReturn(specimen); Object result = this.relay.create(request, null); assertSame(specimen, result); }