use of org.nanohttpd.protocols.http.tempfiles.DefaultTempFile in project nanohttpd by NanoHttpd.
the class JavaIOTempDirExistTest method testJavaIoTempDefault.
@Test
public void testJavaIoTempDefault() throws Exception {
String tmpdir = System.getProperty("java.io.tmpdir");
DefaultTempFileManager manager = new DefaultTempFileManager();
DefaultTempFile tempFile = (DefaultTempFile) manager.createTempFile("xx");
File tempFileBackRef = new File(tempFile.getName());
Assert.assertEquals(tempFileBackRef.getParentFile(), new File(tmpdir));
// force an exception
tempFileBackRef.delete();
Exception e = null;
try {
tempFile.delete();
} catch (Exception ex) {
e = ex;
}
Assert.assertNotNull(e);
manager.clear();
}
Aggregations