### Question:
FixedLengthInputStream extends InputStream { public void skipRemaining() throws IOException { while (available() > 0) { skip(available()); } } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b, int offset, int length); @Override int read(byte[] b); @Override long skip(long n); @Override String toString(); void skipRemaining();  }### Answer:
@Test public void skipRemaining_shouldExhaustStream() throws IOException { FixedLengthInputStream fixedLengthInputStream = new FixedLengthInputStream(inputStream("Hello World"), 5); fixedLengthInputStream.skipRemaining(); assertInputStreamExhausted(fixedLengthInputStream); }
@Test public void skipRemaining_shouldNotConsumeMoreThanLimitFromUnderlyingInputStream() throws IOException { InputStream inputStream = inputStream("Hello World"); FixedLengthInputStream fixedLengthInputStream = new FixedLengthInputStream(inputStream, 6); fixedLengthInputStream.skipRemaining(); assertRemainingInputStreamEquals("World", inputStream); }