[utilities COMMIT] /java-support/trunk/src/test/java/net/shibboleth/utilities/java/support/scripting/EvaluableScriptT...
noreply at shibboleth.net
noreply at shibboleth.net
Mon Feb 23 10:13:38 EST 2015
Author: rdw
Date: Mon Feb 23 10:13:38 2015
New Revision: 763
URL: http://svn.shibboleth.net/view/utilities?rev=763&view=rev
Log:
JSE-11 Clean up droppings left by badly constructed test.
Modified:
java-support/trunk/src/test/java/net/shibboleth/utilities/java/support/scripting/EvaluableScriptTest.java
Modified: java-support/trunk/src/test/java/net/shibboleth/utilities/java/support/scripting/EvaluableScriptTest.java
URL: http://svn.shibboleth.net/view/utilities/java-support/trunk/src/test/java/net/shibboleth/utilities/java/support/scripting/EvaluableScriptTest.java?rev=763&r1=762&r2=763&view=diff
==============================================================================
--- java-support/trunk/src/test/java/net/shibboleth/utilities/java/support/scripting/EvaluableScriptTest.java (original)
+++ java-support/trunk/src/test/java/net/shibboleth/utilities/java/support/scripting/EvaluableScriptTest.java Mon Feb 23 10:13:38 2015
@@ -26,6 +26,7 @@
import net.shibboleth.utilities.java.support.logic.ConstraintViolationException;
import org.testng.Assert;
+import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
/** Tests for {@link EvaluableScript}.*/
@@ -37,6 +38,14 @@
/** A simple script to set a constant value. */
private static final String TEST_SIMPLE_SCRIPT = "importPackage(Packages.net.shibboleth.idp.attribute);\n"
+ "foo = res = new Attribute(\"bar\");\n foo.addValue(\"value\");\n";
+
+ private File theFile;
+
+ @AfterClass public void deleteFile() {
+ if (null != theFile && theFile.exists()) {
+ theFile.delete();
+ }
+ }
@Test public void testEvaluableScript() throws ScriptException, IOException {
@@ -71,16 +80,16 @@
// OK
}
- File f = File.createTempFile("shibTest", "js");
+ File theFile = File.createTempFile("shibTest", ".js");
- FileWriter s = new FileWriter(f);
+ FileWriter s = new FileWriter(theFile);
s.write(TEST_SIMPLE_SCRIPT, 0, TEST_SIMPLE_SCRIPT.length());
s.close();
- Assert.assertEquals((new EvaluableScript(SCRIPT_LANGUAGE, f)).getScriptLanguage(), SCRIPT_LANGUAGE);
+ Assert.assertEquals((new EvaluableScript(SCRIPT_LANGUAGE, theFile)).getScriptLanguage(), SCRIPT_LANGUAGE);
try {
- new EvaluableScript(null, f);
+ new EvaluableScript(null, theFile);
Assert.fail();
} catch (ConstraintViolationException e) {
// OK
More information about the commits
mailing list