mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-03 08:39:09 +00:00
35 lines
835 B
Java
35 lines
835 B
Java
package org.parabot;
|
|
|
|
import org.junit.Assert;
|
|
import org.junit.Test;
|
|
import org.parabot.core.Directories;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
|
|
/**
|
|
* @author JKetelaar
|
|
*/
|
|
public class CacheValidation {
|
|
|
|
@Test
|
|
public void test(){
|
|
try {
|
|
File fileOne = new File(Directories.getCachePath(), "should-exist.tmp");
|
|
File fileTwo = new File(Directories.getCachePath(), "should-not-exist.tmp");
|
|
|
|
fileOne.createNewFile();
|
|
fileTwo.createNewFile();
|
|
|
|
fileTwo.setLastModified(System.currentTimeMillis() / 1000 - 350000);
|
|
|
|
Directories.clearCache(259200, false);
|
|
|
|
Assert.assertTrue(fileOne.exists());
|
|
Assert.assertTrue(!fileTwo.exists());
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|