UnsyncBufferedReader extends Reader { @Override public void close() throws IOException { if (_reader != null) { _reader.close(); _reader = null; _buffer = null; } } UnsyncBufferedReader(Reader reader);  UnsyncBufferedReader(Reader reader, int size); @Override void close(); @Override void mark(int markLimit); @Override boolean markSupported(); @Override int read(); @Override int read(char[] chars); @Override int read(char[] chars, int offset, int length); String readLine(); @Override boolean ready(); @Override void reset(); @Override long skip(long skip);  }
@Test public void testClose() throws Exception { UnsyncBufferedReader unsyncBufferedReader = new UnsyncBufferedReader( new StringReader("")); unsyncBufferedReader.close(); Assert.assertNull(_bufferField.get(unsyncBufferedReader)); Assert.assertNull(_readerField.get(unsyncBufferedReader)); try { unsyncBufferedReader.readLine(); Assert.fail(); } catch (IOException ioException) { Assert.assertEquals("Reader is null", ioException.getMessage()); } testClose(unsyncBufferedReader, "Reader is null"); }