### Question:
NullReader extends Reader { @Override public long skip(final long numberOfChars) throws IOException { if (eof) { throw new IOException("Skip after end of file"); } if (position == size) { return doEndOfFile(); } position += numberOfChars; long returnLength = numberOfChars; if (position > size) { returnLength = numberOfChars - (position - size); position = size; } return returnLength; } NullReader(final long size);  NullReader(final long size, final boolean markSupported, final boolean throwEofException); long getPosition(); long getSize(); @Override void close(); @Override synchronized void mark(final int readlimit); @Override boolean markSupported(); @Override int read(); @Override int read(final char[] chars); @Override int read(final char[] chars, final int offset, final int length); @Override synchronized void reset(); @Override long skip(final long numberOfChars);  }### Answer:
@Test public void testSkip() throws Exception { final Reader reader = new TestNullReader(10, true, false); assertEquals("Read 1", 0, reader.read()); assertEquals("Read 2", 1, reader.read()); assertEquals("Skip 1", 5, reader.skip(5)); assertEquals("Read 3", 7, reader.read()); assertEquals("Skip 2", 2, reader.skip(5)); assertEquals("Skip 3 (EOF)", -1, reader.skip(5)); try { reader.skip(5); fail("Expected IOException for skipping after end of file"); } catch (final IOException e) { assertEquals("Skip after EOF IOException message", "Skip after end of file", e.getMessage()); } reader.close(); }