mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-06 06:21:16 +07:00
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:
+10
-4
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user