### Question:
Mapper implements Closeable { public <T> T[] readArray(final Reader stream, final Class<T> clazz) { try (final JsonReader reader = readerFactory.createReader(stream(stream))) { return (T[]) mapArray(clazz, reader); } } Mapper(final JsonReaderFactory readerFactory, final JsonGeneratorFactory generatorFactory,
           final JsonBuilderFactory builderFactory, final JsonProvider provider,
           final MapperConfig config, final Collection<Closeable> closeables); void writeArray(final Object object, final OutputStream stream); void writeArray(final T[] object, final OutputStream stream); void writeArray(final T[] object, final Writer stream); void writeArray(final Collection<T> object, final OutputStream stream); void writeArray(final Collection<T> object, final Writer stream); void writeIterable(final Iterable<T> object, final OutputStream stream); void writeIterable(final Iterable<T> object, final Writer stream); JsonValue toStructure(final Object object); void writeObject(final Object object, final Writer stream); void writeObjectWithGenerator(final Object object, final JsonGenerator generator); void writeObject(final Object object, final OutputStream stream); String writeArrayAsString(final Collection<?> instance); String writeArrayAsString(final T[] instance); String writeObjectAsString(final Object instance); T readObject(final JsonValue value, final Type clazz); T readObject(final String string, final Type clazz); T readObject(final Reader stream, final Type clazz); T readObject(final JsonParser stream, final Type clazz); T readObject(final InputStream stream, final Type clazz); Collection<T> readCollection(final InputStream stream, final ParameterizedType genericType); T readJohnzonCollection(final InputStream stream, final JohnzonCollectionType<T> genericType); T readJohnzonCollection(final Reader stream, final JohnzonCollectionType<T> genericType); Collection<T> readCollection(final Reader stream, final ParameterizedType genericType); Collection<T> readCollection(final JsonParser stream, final ParameterizedType genericType); T[] readArray(final Reader stream, final Class<T> clazz); T readTypedArray(final InputStream stream, final Class<?> elementType, final Class<T> arrayType); T readTypedArray(final Reader stream, final Class<?> elementType, final Class<T> arrayType); T readTypedArray(final JsonParser parser, final Class<?> elementType, final Class<T> arrayType); JsonArray readJsonArray(final Reader stream); JsonArray readJsonArray(final JsonParser stream); T[] readArray(final InputStream stream, final Class<T> clazz); JsonArray readJsonArray(final InputStream stream); @Override synchronized void close(); JsonBuilderFactory getBuilderFactory(); JsonProvider getProvider();  }### Answer:
@Test public void readEmptyArray() { final TheObject[] object = new MapperBuilder().build().readArray(new ByteArrayInputStream("[]".getBytes()), TheObject.class); assertNotNull(object); assertEquals(0, object.length); }
@Test public void readArray() { final TheObject[] object = new MapperBuilder().build().readArray( new ByteArrayInputStream(("[" + "{" + "\"name\":\"a3\"," + "\"intVal\":5," + "\"longnumber\":6" + "}," + "{" + "\"name\":\"a4\"," + "\"intVal\":7," + "\"longnumber\":8" + "}" + "]").getBytes()), TheObject.class); assertNotNull(object); assertEquals(2, object.length); assertEquals("a3", object[0].name); assertEquals(5, object[0].intVal); assertEquals(6, object[0].longnumber); assertEquals("a4", object[1].name); assertEquals(7, object[1].intVal); assertEquals(8, object[1].longnumber); }