@Test public void nonExistingFile() { final ScriptFile scriptFile = new ClasspathScriptFile("de/axelfaust/alfresco/nashorn/repo/loaders/test1.js"); Assert.assertFalse("test1.js does exist", scriptFile.exists(false)); Assert.assertEquals("test1.js is not -1", -1, scriptFile.getSize(false)); Assert.assertEquals( "test1.js last modification time is not -1", -1, scriptFile.getLastModified(false)); }
@Test public void existingFile() { final ScriptFile scriptFile = new ClasspathScriptFile("de/axelfaust/alfresco/nashorn/repo/loaders/empty.js"); Assert.assertTrue("empty.js does not exist", scriptFile.exists(false)); Assert.assertTrue("empty.js is not of a positive integer", scriptFile.getSize(false) > 0); // 13 characters + EOL/EOF Assert.assertEquals("empty.js is not of a expected size", 13 + 1, scriptFile.getSize(false)); Assert.assertTrue( "empty.js last modification time is not a positive integer", scriptFile.getLastModified(false) > 0); }