### Question:
ArrayGenerator implements Generator<T[]> { @Override public T[] next() { final int size = randomValues.randomInteger(sizeRange.lowerBound(), sizeRange.upperBound()); final T[] arrayOfT = newArray(classOfT, size); for (int i = 0; i < size; i++) { arrayOfT[i] = generatorOfT.next(); } return arrayOfT; } ArrayGenerator(final RandomValues randomValues, final Class<? extends T> classOfT, final Generator<? extends T> generatorOfT, final Range<Integer> sizeRange); @Override T[] next();  }### Answer:
@Test public void generatesArrayOfDefaultSizeWhenNoneSpecified() { assertThat(RDG.array(Integer.class, generatingFrom(1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7)).next()) .hasSize(DEFAULT_SIZE) .containsExactly(1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1, 0, -1); }
@Test public void generatesEmptyArray() { assertThat(RDG.array(Integer.class, generatingRandomIntegers(), 0).next()).isEmpty(); }
@Test public void generatesArrayOfSize() { assertThat(RDG.array(String.class, generatingFrom("a", "b", "c", "d", "e"), 5).next()) .hasSize(5) .containsExactly("a", "b", "c", "d", "e"); }
@Test public void generatesArrayForFixedSizeRange() { assertThat(RDG.array(String.class, generatingFrom("a", "b", "c"), fixed(3)).next()) .hasSize(3) .containsExactly("a", "b", "c"); }
@Test public void generatesArrayUpToMaximumSize() { assertThat(RDG.array(Integer.class, generatingRandomIntegers(), MAX_SIZE + 1).next()) .hasSize(MAX_SIZE); }
@Test public void generatesEmptyArrayForNegativeSize() { assertThat(RDG.array(Integer.class, generatingRandomIntegers(), -1).next()) .isEmpty(); }
@Test public void generatesEmptyArrayForNegativeFixedSizeRange() { assertThat(RDG.array(Integer.class, generatingRandomIntegers(), fixed(-1)).next()) .isEmpty(); }
@Test public void generatesEmptyArrayForNegativeClosedSizeRange() { assertThat(RDG.array(Integer.class, generatingRandomIntegers(), closed(-10, -1)).next()) .isEmpty(); }