### Question:
VirtualDirTgz extends VirtualDir { @Override public void finalize() throws Throwable { super.finalize(); close(); } VirtualDirTgz(File tgz); @Override String getBasePath(); @Override InputStream getInputStream(String path); @Override File getFile(String path); @Override String[] list(String path); @Override void close(); @Override boolean isCompressed(); @Override boolean isArchive(); @Override void finalize(); File getTempDir();  }### Answer:
@Test public void testFinalize() throws Throwable { final File testTgz = TestUtil.getTestFile("tgz/test-archive.tgz"); virtualDir = new VirtualDirTgz(testTgz); assertExpectedFile(); final File tempDir = virtualDir.getTempDir(); assertNotNull(tempDir); final File createDir = new File(tempDir, "test-archive.tgz"); assertTrue(createDir.isDirectory()); virtualDir.finalize(); assertFalse(createDir.isDirectory()); }