### Question:
ArrayRelay implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (!(request instanceof SpecimenType)) { return new NoSpecimen(); } SpecimenType specimenType = (SpecimenType)request; if(!specimenType.getRawType().isArray()) { return new NoSpecimen(); } Class clazz = specimenType.getRawType(); return buildArray(clazz, context); }  @Override Object create(Object request, SpecimenContext context);  }### Answer:
@Test public void non_specimen_type_request_returns_no_specimen() { Object result = this.arrayRelay.create("string", mockSpecimenContext); assertEquals(new NoSpecimen(), result); }
@Test public void non_array_type_request_returns_no_specimen() { Object result = this.arrayRelay.create(SpecimenType.of(int.class), mockSpecimenContext); assertEquals(new NoSpecimen(), result); }
@Test public void non_list_returned_from_multiple_request_returns_no_specimen() { when(mockSpecimenContext.resolve(any(MultipleRequest.class))).thenReturn(String.class); Object result = this.arrayRelay.create(int[].class, mockSpecimenContext); assertEquals(new NoSpecimen(), result); }
@Test public void list_returned_from_multiple_request_is_copied_to_array() { Integer[] array = new Integer[]{1, 2, 3}; List<Integer> list = Arrays.asList(1, 2, 3); when(mockSpecimenContext.resolve(any(MultipleRequest.class))).thenReturn(list); Integer[] result = (Integer[])this.arrayRelay.create(SpecimenType.of(Integer[].class), mockSpecimenContext); assertArrayEquals(array, result); }