deleting vfs after a test run

My plugin test involves creating a vfs as follows:

 

getInstance(getProject()).getProject().getBaseDir().createChildDirectory(this, "mydir");
VirtualFile childDirectory = getInstance(getProject()).getProject().getBaseDir().findChild("mydir").createChildDirectory(this, "childOne");
VirtualFile txt1Data = getInstance(getProject()).getProject().getBaseDir().findChild("mydir").findChild("childOne").createChildData(this,"somedataone.txt");
VirtualFile txt2Data = getInstance(getProject()).getProject().getBaseDir().findChild("mydir").findChild("childOne").createChildData(this, "somedatatwo.txt");
byte[] txt1array = Files.readAllBytes(new File("testData/mydir/childOne/text1.txt").toPath()); //testData is folder for resource files
byte[] txt2array = Files.readAllBytes(new File("testData/mydir/childOne/test2.txt").toPath());
txt1Data.setBinaryContent(txt1array);
txt2Data.setBinaryContent(txt2array);

as part of tear down I do:
getInstance(getProject()).getProject().getBaseDir().delete(this);

This works fine when you have s single test that is creating vfs but when it runs multiple tests i get an err regarding

=> java.lang.IllegalStateException: Previous test did not call assertPointersAreDisposed()

Before creating the vfs using above method i also tried findOrCreateChildData() and copyDirectoryToProject() methods neither of the calls created the vfs i was trying
to create.

what is the best way to create the vfs, and delete it during teardown for consistent runs?
0
Avatar
Permanently deleted user

Hi, have you found any solution, I am getting the same error.

0

请先登录再写评论。