### Question:
RackInput implements Closeable { public byte[] read(Integer length) throws IOException { if (length == null) { return readToEof(); } else { return readTo(length); } } RackInput(InputStream inputStream); byte[] gets(); byte[] read(Integer length); void rewind(); @Override void close();  }### Answer:
@Test public void readWithLengthNilAtEof() throws Exception { assertThat(empty.read(null)).isEqualTo(EMPTY_BYTES); }
@Test public void readWithLengthZeroAtEof() throws Exception { assertThat(empty.read(0)).isEqualTo(EMPTY_BYTES); }
@Test public void readWithLengthAtEof() throws Exception { assertThat(empty.read(1)).isNull(); }
@Test public void readWithLengthNil() throws Exception { assertThat(full.read(null)).isEqualTo(BYTES); }
@Test public void readWithLengthNilAgain() throws Exception { full.read(null); assertThat(full.read(null)).isEqualTo(EMPTY_BYTES); }
@Test public void readWithLengthZero() throws Exception { assertThat(full.read(0)).isEqualTo(EMPTY_BYTES); }
@Test public void readWithLength() throws Exception { assertThat(full.read(4)).isEqualTo(copyOfRange(BYTES, 0, 4)); }
@Test public void readWithLengthAgain() throws Exception { full.read(4); assertThat(full.read(4)).isEqualTo(copyOfRange(BYTES, 4, 8)); }
@Test public void readFromSlowStreamWithLength() throws Exception { assertThat(fullSlow.read(4)).isEqualTo(copyOfRange(BYTES, 0, 4)); }
@Test public void readFromSlowStreamWithLengthAgain() throws Exception { fullSlow.read(4); assertThat(fullSlow.read(4)).isEqualTo(copyOfRange(BYTES, 4, 8)); }
@Test public void readWithLengthTooLong() throws Exception { assertThat(full.read(BYTES.length + 1)).isEqualTo(BYTES); }
@Test public void readWithLengthTooLongAgain() throws Exception { full.read(BYTES.length + 1); assertThat(full.read(BYTES.length + 1)).isNull(); }