### Question:
ArrayPopulator { Object getRandomArray(final Class<?> fieldType, final RandomizationContext context) { Class<?> componentType = fieldType.getComponentType(); int randomSize = getRandomArraySize(context.getParameters()); Object result = Array.newInstance(componentType, randomSize); for (int i = 0; i < randomSize; i++) { Object randomElement = easyRandom.doPopulateBean(componentType, context); Array.set(result, i, randomElement); } return result; } ArrayPopulator(final EasyRandom easyRandom);   }### Answer:
@Test void getRandomArray() { when(context.getParameters()).thenReturn(new EasyRandomParameters().collectionSizeRange(INT, INT)); when(easyRandom.doPopulateBean(String.class, context)).thenReturn(STRING); String[] strings = (String[]) arrayPopulator.getRandomArray(String[].class, context); assertThat(strings).containsOnly(STRING); }