JMRI / JMRI

JMRI model railroad digital command & control software
https://www.jmri.org
Other
235 stars 330 forks source link

Unable to mock in JDK 11 #8170

Closed rhwood closed 4 years ago

rhwood commented 4 years ago

I am getting a number of failures running ant test-single -Dtest.includes=jmri.jmrix.openlcb.OlcbClockControlTest:

Mockito cannot mock this class: interface jmri.jmrix.openlcb.OlcbClockControlTest$MockInterface.

Mockito can only mock non-private & non-final classes.

The full ant output is below and the reports are attached:

Buildfile: /Users/rhwood/Developer/JMRI/JMRI/rhwood/JMRI/build.xml

-pre-single-test:

-test-single-src:

-test-single-test:

init:
   [script] Warning: Nashorn engine is planned to be removed from a future JDK release

copyfiles:
     [copy] Copying 17 files to /Users/rhwood/Developer/JMRI/JMRI/rhwood/JMRI/target/classes/resources

jjtree:
   [script] Warning: Nashorn engine is planned to be removed from a future JDK release

javacc:
   [script] Warning: Nashorn engine is planned to be removed from a future JDK release

update-template-code:
     [copy] Copying 1 file to /Users/rhwood/Developer/JMRI/JMRI/rhwood/JMRI/java/tmp

compile-generated-source:
     [copy] Copying 1 file to /Users/rhwood/Developer/JMRI/JMRI/rhwood/JMRI/target/classes/jmri

compile:
    [javac] Compiling 42 source files to /Users/rhwood/Developer/JMRI/JMRI/rhwood/JMRI/target/classes
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 8
    [javac] warning: Supported source version 'RELEASE_7' from annotation processor 'org.netbeans.modules.openide.util.ServiceProviderProcessor' less than -source '8'
    [javac] warning: Supported source version 'RELEASE_7' from annotation processor 'org.netbeans.modules.openide.util.NamedServiceProcessor' less than -source '8'
    [javac] 3 warnings

debug:

tests:
    [javac] Compiling 3 source files to /Users/rhwood/Developer/JMRI/JMRI/rhwood/JMRI/target/test-classes
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 8
    [javac] warning: Supported source version 'RELEASE_7' from annotation processor 'org.netbeans.modules.openide.util.ServiceProviderProcessor' less than -source '8'
    [javac] warning: Supported source version 'RELEASE_7' from annotation processor 'org.netbeans.modules.openide.util.NamedServiceProcessor' less than -source '8'
    [javac] Note: /Users/rhwood/Developer/JMRI/JMRI/rhwood/JMRI/java/acceptancetest/step_definitions/apps/ApplicationTestAcceptanceSteps.java uses or overrides a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] 3 warnings

runtime-library-selection:
     [echo] arch.lib.path /Users/rhwood/Developer/JMRI/JMRI/rhwood/JMRI/lib/macosx/x86_64:/Users/rhwood/Developer/JMRI/JMRI/rhwood/JMRI/lib/macosx

test-single:
[junitlauncher] Feb 22, 2020 5:14:18 AM org.junit.platform.launcher.core.LauncherConfigurationParameters fromClasspathResource
[junitlauncher] INFO: Loading JUnit Platform configuration parameters from classpath resource [file:/Users/rhwood/Developer/JMRI/JMRI/rhwood/JMRI/target/test-classes/junit-platform.properties].
[junitlauncher]  Class Started: JUnit Jupiter
[junitlauncher]  Class Started: JUnit Vintage
[junitlauncher]  Class Started: OlcbClockControlTest
[junitlauncher]    Test Started:  loadAndRestartWithStopAndNoRate
[junitlauncher]    Test Started:  rateListenerSlave
[junitlauncher] FAILED:           rateListenerSlave
[junitlauncher] 
[junitlauncher]    Test Started:  setRateMaster
[junitlauncher]    Test Started:  loadAndRestartWithNoRunAndNoRateStopped
[junitlauncher]    Test Started:  rateListenerMasterRounding
[junitlauncher] FAILED:           rateListenerMasterRounding
[junitlauncher] 
[junitlauncher]    Test Started:  loadAndRestartLeavesRate
[junitlauncher]    Test Started:  getHardwareClockNameSlave
[junitlauncher]    Test Started:  getHardwareClockNameMaster
[junitlauncher]    Test Started:  loadAndRestartLeavesRunState
[junitlauncher]    Test Started:  rateListenerMaster
[junitlauncher] FAILED:           rateListenerMaster
[junitlauncher] 
[junitlauncher]    Test Started:  defaultNoClock
[junitlauncher]    Test Started:  noClockNeeded
[junitlauncher]    Test Started:  rateListenerSlaveRounding
[junitlauncher] FAILED:           rateListenerSlaveRounding
[junitlauncher] 
[junitlauncher]    Test Started:  stopHardwareClockSlave
[junitlauncher]    Test Started:  rateListenerMasterRoundingAtZero
[junitlauncher] FAILED:           rateListenerMasterRoundingAtZero
[junitlauncher] 
[junitlauncher]    Test Started:  setTimeMaster
[junitlauncher]    Test Started:  loadAndRestartWithStopAndRate
[junitlauncher]    Test Started:  thisTestDidNotKillJemmy
[junitlauncher]    Test Started:  loadAndRestartWithNoRunAndNoRate
[junitlauncher]    Test Started:  customClockId
[junitlauncher]    Test Started:  setRate
[junitlauncher]    Test Started:  setTime
[junitlauncher]    Test Started:  stopHardwareClock
[junitlauncher] 
[junitlauncher] Test run finished after 21638 ms
[junitlauncher] [         3 containers found      ]
[junitlauncher] [         0 containers skipped    ]
[junitlauncher] [         3 containers started    ]
[junitlauncher] [         0 containers aborted    ]
[junitlauncher] [         3 containers successful ]
[junitlauncher] [         0 containers failed     ]
[junitlauncher] [        23 tests found           ]
[junitlauncher] [         0 tests skipped         ]
[junitlauncher] [        23 tests started         ]
[junitlauncher] [         0 tests aborted         ]
[junitlauncher] [        18 tests successful      ]
[junitlauncher] [         5 tests failed          ]
[junitlauncher] 

BUILD FAILED
/Users/rhwood/Developer/JMRI/JMRI/rhwood/JMRI/build.xml:757: condition satisfied

Total time: 42 seconds

TEST-jmri.jmrix.openlcb.OlcbClockControlTest.txt TEST-jmri.jmrix.openlcb.OlcbClockControlTest.xml.txt

rhwood commented 4 years ago

Testing reveals that simply updating Mockito appears to address this, so this should be fixed by #8171