Skip to content

Commit 527cc2b

Browse files
committed
8248551: [TestBug] Ignore two failing FXML unit tests which use Nashorn script engine
Reviewed-by: kcr
1 parent 45c9854 commit 527cc2b

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

modules/javafx.fxml/src/test/java/test/javafx/fxml/FXMLLoader_ScriptTest.java

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package test.javafx.fxml;
22
/*
3-
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -31,8 +31,11 @@
3131
import java.util.concurrent.atomic.AtomicBoolean;
3232
import javafx.fxml.FXMLLoader;
3333
import javafx.fxml.LoadListener;
34+
import javax.script.ScriptEngineManager;
35+
import javax.script.ScriptEngine;
3436

3537
import static org.junit.Assert.*;
38+
import static org.junit.Assume.assumeTrue;
3639

3740
public class FXMLLoader_ScriptTest {
3841
@Test
@@ -130,6 +133,10 @@ public void endElement(Object value) {
130133
@Test
131134
public void testScriptHandler() throws IOException {
132135

136+
// This test needs Nashorn script engine.
137+
// Test will be rewritten under - JDK-8245568
138+
assumeTrue(isNashornEngineAvailable());
139+
133140
FXMLLoader loader = new FXMLLoader(getClass().getResource("script_handler.fxml"));
134141
loader.load();
135142

@@ -143,6 +150,10 @@ public void testScriptHandler() throws IOException {
143150
@Test
144151
public void testExternalScriptHandler() throws IOException {
145152

153+
// This test needs Nashorn script engine.
154+
// Test will be rewritten under - JDK-8245568
155+
assumeTrue(isNashornEngineAvailable());
156+
146157
FXMLLoader loader = new FXMLLoader(getClass().getResource("script_handler_external.fxml"));
147158
loader.load();
148159

@@ -152,4 +163,11 @@ public void testExternalScriptHandler() throws IOException {
152163
w.fire();
153164
assertTrue(((AtomicBoolean)loader.getNamespace().get("actionDone")).get());
154165
}
166+
167+
private boolean isNashornEngineAvailable() {
168+
ScriptEngineManager factory = new ScriptEngineManager();
169+
ScriptEngine engine = factory.getEngineByName("nashorn");
170+
171+
return (engine != null);
172+
}
155173
}

0 commit comments

Comments
 (0)