[Minor] cleaned up test
tests left some state files, which are now cleaned up as well
This commit is contained in:
parent
e0f0b67f60
commit
717e2de556
|
@ -26,6 +26,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
|
||||||
|
import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -106,6 +107,25 @@ public class PrivilegeTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void destroy() throws Exception {
|
||||||
|
|
||||||
|
// delete temporary file
|
||||||
|
String pwd = System.getProperty("user.dir");
|
||||||
|
|
||||||
|
File tmpPrivilegeModelFile = new File(pwd + "/target/test/PrivilegeModel.xml");
|
||||||
|
if (tmpPrivilegeModelFile.exists() && !tmpPrivilegeModelFile.delete()) {
|
||||||
|
throw new RuntimeException("Tmp configuration still exists and can not be deleted at "
|
||||||
|
+ tmpPrivilegeModelFile.getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
// and temporary parent
|
||||||
|
File parentFile = tmpPrivilegeModelFile.getParentFile();
|
||||||
|
if (parentFile.exists() && !parentFile.delete()) {
|
||||||
|
throw new RuntimeException("Could not remove temporary parent for tmp " + tmpPrivilegeModelFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() throws Exception {
|
public void setup() throws Exception {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue