@Test
public void testUnpackCacheLimit() throws Exception {

	final int cacheSize = 20;
	HotColdFileCache unpackCache = new HotColdFileCache(cacheSize);
	FileFactory fileFactory = new FileFactory(unpackCache);
	IndexingConfig config = new IndexingConfig();
	File archive = TestFiles.simple_7z.get();
	for (int i = 0; i < cacheSize * 2; i++) {
		File archiveCopy = Util.createDerivedTempFile("test.7z", Util.TEMP_DIR);
		Files.copy(archive, archiveCopy);
		String path = Util.joinPath(Util.getAbsPath(archiveCopy), "test.txt");
		FileResource fileResource = fileFactory.createFile(config, new Path(path));
		File tempFile = fileResource.getFile();
		assertTrue(tempFile.isFile());
		fileResource.dispose();
		int actualCacheSize = unpackCache.getActualCacheSize();
		assertTrue(0 < actualCacheSize);
		assertTrue(actualCacheSize <= cacheSize);
	}
}