### Question:
TempfileBufferedInputStream extends InputStream { @Override public int read() throws IOException { byte[] bytes = new byte[1]; int read = read(bytes); return (read > 0) ? bytes[0] & 0xff : -1; } TempfileBufferedInputStream(InputStream source);  TempfileBufferedInputStream(InputStream source, int threshold); @Override int read(); @Override int read(byte[] bytes); @Override int read(byte[] bytes, int offset, int length); @Override synchronized void reset(); @Override synchronized void mark(int i); @Override boolean markSupported(); @Override void close();  }### Answer:
@Test public void shouldNotLeaveTempFilesLingering() throws Exception { String originalTmpdir = System.getProperty("java.io.tmpdir"); System.setProperty("java.io.tmpdir", tempDir.getRoot().toString()); try { InputStream subject = new TempfileBufferedInputStream(containing("123456789"), 3); read(subject); assertThat(tempDir.getRoot().listFiles()).isEmpty(); } finally { System.setProperty("java.io.tmpdir", originalTmpdir); } }