@Test(expected = IOException.class) public void testAvailableThrowsIfStreamIsClosed() throws IOException { stream.close(); stream.available(); }
@Test public void testReturnsWrappedAvailable() throws IOException { when(wrapped.available()).thenReturn(25); assertEquals(25, is.available()); }
@Test public void testAvailableReturnsWrappedAvailableIfNoBytesRead() throws IOException { assertEquals(DATA_SIZE, stream.available()); }
@Test public void testAvailableIncludesDataInBufferAndWrappedAvailableIfBytesRead() throws IOException { stream.read(); assertEquals(DATA_SIZE - 1, stream.available()); }