close persistent hash map created in test and cleanup its files. This is needed to avoid problems during running all tests run when test directory containing temp files becomes removed and flush of inmemory state happens much much later

This commit is contained in:
Maxim.Mossienko
2015-06-20 13:32:16 +02:00
parent 6cda21c9aa
commit 30cdd98e50
@@ -19,6 +19,7 @@ import com.intellij.openapi.util.io.FileUtil;
import com.intellij.testFramework.UsefulTestCase;
import com.intellij.util.io.CaseInsensitiveEnumeratorStringDescriptor;
import com.intellij.util.io.DataExternalizer;
import com.intellij.util.io.IOUtil;
import org.jetbrains.annotations.NotNull;
import java.io.*;
@@ -40,10 +41,15 @@ public class ObjectObjectPersistentMultiMapletTest extends UsefulTestCase {
new ObjectObjectPersistentMultiMaplet<String, IntValueStreamable>(file, new CaseInsensitiveEnumeratorStringDescriptor(),
new IntValueExternalizer(),
COLLECTION_FACTORY);
maplet.put("a", new IntValueStreamable(1));
assertEquals(1, assertOneElement(maplet.get("a")).value);
maplet.replace("A", Collections.singletonList(new IntValueStreamable(2)));
assertEquals(2, assertOneElement(maplet.get("a")).value);
try {
maplet.put("a", new IntValueStreamable(1));
assertEquals(1, assertOneElement(maplet.get("a")).value);
maplet.replace("A", Collections.singletonList(new IntValueStreamable(2)));
assertEquals(2, assertOneElement(maplet.get("a")).value);
} finally {
maplet.close();
IOUtil.deleteAllFilesStartingWith(file);
}
}
private static class IntValueStreamable implements Streamable {