@Test
public void testRead() throws Exception {

  final ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
  final ByteArrayOutputStream byteOut2 = new ByteArrayOutputStream();
  text.read(() -> byteOut);
  text.read(in -> IoUtils.redirect(in, byteOut2));
  assertArrayEquals(expected.getBytes(), byteOut.toByteArray());
  assertArrayEquals(expected.getBytes(), byteOut2.toByteArray());
}