Refactoring junit tests.

David Hill David.Hill at Oracle.com
Mon Sep 14 12:01:25 UTC 2015


Just a heads up regarding the changes to the junit test code.

I have already refactored two of the modules junit test code (base & graphics), and plan to work through the rest in the coming weeks.

This means that once a module is complete:

New tests/resources will be under the the package test (ie. package test.javafx.scene instead of javafx.scene).

These new tests can only directly access public API, as well as "Shim <http://dictionary.reference.com/browse/shim>" test classes. These are the "black box" test classes because they cannot see internal/protected API.

Shim <http://dictionary.reference.com/browse/shim>classes can live in the javafx namespace, and expose protected API to the test classes (at least they live in this namespace while we run the tests). These are the "white box" allowances that can help the black box tests by granting access to internal/protected API. The intent is that we should create as few white box Shims as is needed, and to put as little code in them as is required. To make it easy to know it is a shim class, I have helpfully added Shim to the name.

The JUnit calls can only be in the black box tests.

The goad of all of this rework is running these tests under the new Jigsaw modules system. With JDK8 we were avoiding some of the protections class loaders provide because of the way we were running the tests. With Jake we no longer can bend the system that much, and so have had to rework the tests so they play nicely with the protections that are in place.


-- 
David Hill<David.Hill at Oracle.com>
Java Embedded Development

"A man's feet should be planted in his country, but his eyes should survey the world."
-- George Santayana (1863 - 1952)



More information about the openjfx-dev mailing list