Failing unit tests
Closed this issue ยท 10 comments
We have 19 unit tests failing:
https://josm.openstreetmap.de/jenkins/job/Java-EarlyAccess-JOSM-Plugins/79/jdk=JDK12/testReport/
All with the same stacktrace:
junit.framework.AssertionFailedError: modifiers
at org.openstreetmap.josm.plugins.mapillary.utils.TestUtil.getAccessibleField(TestUtil.java:40)
at org.openstreetmap.josm.plugins.mapillary.io.download.SequenceDownloadRunnableTest.setUp(SequenceDownloadRunnableTest.java:39)
at org.openstreetmap.josm.testutils.JOSMTestRules$TimeoutThread.run(JOSMTestRules.java:700)
Thank you for reporting, this has to do with reflective access to private fields in unit tests. Probably something has been changed in Java 12 that does no longer allow certain access. I already saw a deprecation warning when compiling with Java 10 in that part of the code.
I will take a look and see what I can do.
Just for reference:
It seems like Java is now carrying out what they already warn about when compiling with Java 10:
> Task :test
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.openstreetmap.josm.plugins.mapillary.utils.TestUtil (file:/builds/JOSM/Mapillary/build/classes/java/test/) to field java.lang.reflect.Field.modifiers
WARNING: Please consider reporting this to the maintainers of org.openstreetmap.josm.plugins.mapillary.utils.TestUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
๐ Finished after 38.83 seconds.
(excerpt of https://gitlab.com/JOSM/Mapillary/-/jobs/101974395)
Can you please log the stacktrace instead of just displaying the localized message? We don't know what exact exception is raised.
I'm removing the whole method, so this won't be a problem anymore.
This should be solved in 3cce61d#diff-8f6c53a4b886fcd4f27f7eeeeadc0fd6L31 .
Thanks! I have relaunched manually a build: https://josm.openstreetmap.de/jenkins/job/Java-EarlyAccess-JOSM-Plugins/80/
Much better, only two issues remaining:
https://josm.openstreetmap.de/jenkins/job/Java-EarlyAccess-JOSM-Plugins/lastCompletedBuild/jdk=JDK12/testReport/
Yes, one has to do with WireMock, where I forgot to add a stub for a certain URL, that's easy to fix.
The other one looks to me as if the unit tests can't access resources for classes from the main source set, in this case an image located in src/main/resources/images
. @don-vip : Is there something I can add to build.xml
that adds src/main/resources/
to the test classpath?
I'll reopen this, until it's completely resolved.
I just have added a new property in build-common.xml
So now you simply need to add:
<property name="plugin.resources.dir" value="src/main/resources"/>
Thanks! I now pushed e2df796...5d8911c , which should fix the failing tests.