@Test
public void testRead() throws IOException {

  try (LimitInputStream limitInputStream =
    new LimitInputStream(new RandomInputStream(), 0)) {
    assertEquals("Reading byte after reaching limit should return -1", -1,
        limitInputStream.read());
  }
  try (LimitInputStream limitInputStream =
    new LimitInputStream(new RandomInputStream(), 4)) {
    assertEquals("Incorrect byte returned", new Random(0).nextInt(),
        limitInputStream.read());
  }
}