### Question:
LimitedInputStream extends InputStream { public void close() throws IOException { m_limit = 0; m_source.close(); } LimitedInputStream(InputStream source); int getLimit(); void setLimit(int length); int read(); int read(byte buffer[], int offset, int length); long skip(long n); int available(); void close();  }### Answer:
@Test public void close() throws IOException { CountClose m_counter; m_counter = new CountClose(); m_fixture = new LimitedInputStream(m_counter); m_fixture.setLimit(5); m_fixture.close(); assertEquals(1, m_counter.getCloseCount()); assertEquals(0, m_fixture.getLimit()); }