-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Max Rohde
committed
Feb 19, 2018
1 parent
a81c504
commit b2c771e
Showing
2 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/test/java/delight/nashornsandbox/TestIssue40_ScriptEngineParameters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package delight.nashornsandbox; | ||
|
||
import java.io.File; | ||
|
||
import javax.script.ScriptException; | ||
|
||
import org.junit.Test; | ||
|
||
import delight.nashornsandbox.exceptions.ScriptCPUAbuseException; | ||
|
||
/** | ||
* Test for <a href='https://github.com/javadelight/delight-nashorn-sandbox/issues/40'>issue 40</a>. | ||
* | ||
* @author Max Rohde | ||
* | ||
*/ | ||
public class TestIssue40_ScriptEngineParameters { | ||
|
||
@Test(expected=ScriptException.class) | ||
public void test() throws ScriptCPUAbuseException, ScriptException { | ||
|
||
final NashornSandbox sandbox = NashornSandboxes.create("--no-java"); | ||
sandbox.allow(File.class); | ||
|
||
// should throw an exception since 'Java' is not allowed. | ||
sandbox.eval("var File = Java.type('java.io.File'); File;"); | ||
|
||
} | ||
|
||
} |