b10: regression?

Florian Brunner fbrunnerlist at gmx.ch
Thu May 31 15:32:51 PDT 2012


Hi,

On Linux (32-bit) with JavaFX 2.2 b08 I was able to instantiate a control in a unit test, e.g.

import javafx.scene.control.CheckBox;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;


public class MyTest {
    
    public MyTest() {
    }

    
    @Before
    public void setUp() {
        CheckBox cb = new CheckBox("test");
    }
    
    @After
    public void tearDown() {
    }


    @Test
    public void someTest() {
        System.out.println("someTest");
    }

}

With b10 I'm getting an error:

java.lang.ExceptionInInitializerError
	at mypackage.MyTest.setUp(MyTest.java:28)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:236)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:134)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:113)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)
Caused by: java.lang.NullPointerException
	at com.sun.glass.ui.Screen.getMainScreen(Screen.java:15)
	at com.sun.javafx.tk.quantum.QuantumToolkit.getPrimaryScreen(QuantumToolkit.java:589)
	at javafx.stage.Screen.updateConfiguration(Screen.java:102)
	at javafx.stage.Screen.checkDirty(Screen.java:97)
	at javafx.stage.Screen.getPrimary(Screen.java:176)
	at com.sun.javafx.Utils.isQVGAScreen(Utils.java:813)
	at javafx.scene.control.UAStylesheetLoader$1.run(UAStylesheetLoader.java:69)
	at java.security.AccessController.doPrivileged(Native Method)
	at javafx.scene.control.UAStylesheetLoader.loadUAStylesheet(UAStylesheetLoader.java:58)
	at javafx.scene.control.UAStylesheetLoader.doLoad(UAStylesheetLoader.java:51)
	at javafx.scene.control.Control.<clinit>(Control.java:95)
	... 31 more


Is this a regression or a desired behaviour? If it's a desired behaviour: Is there a way to write some simple JUnit tests for controls?

Regards,
Florian


More information about the openjfx-dev mailing list