UnsyncStringReader extends Reader { @Override public void close() { _string = null; } UnsyncStringReader(String string); @Override void close(); @Override void mark(int readAheadLimit); @Override boolean markSupported(); @Override int read(); @Override int read(char[] chars); @Override int read(char[] chars, int offset, int length); @Override boolean ready(); @Override void reset(); @Override long skip(long skip);  }
@Test public void testClose() throws Exception { UnsyncStringReader unsyncStringReader = new UnsyncStringReader( "abcdefg"); unsyncStringReader.close(); Assert.assertNull(_stringField.get(unsyncStringReader)); testClose(unsyncStringReader, "String is null"); }