LookAheadReader extends Reader { @Override public void close() throws IOException { reader.close(); } LookAheadReader(Reader reader); String readLine(); String peekLine(); @Override void close(); @Override int read(char[] cbuf, int off, int len);  }
@Test public void close() throws IOException { Reader delegate = mock(Reader.class); LookAheadReader reader = new LookAheadReader(delegate); verifyNoMoreInteractions(delegate); reader.close(); verify(delegate).close(); reader.close(); verify(delegate).close(); verifyNoMoreInteractions(delegate); }