[ODLPARENT-59] mockito-all is dangerous substance abuse, must always use mockito-core, everywhere; ODL parent could enforce? Created: 23/Jan/17  Updated: 04/Sep/18  Resolved: 04/Sep/18

Status: Resolved
Project: odlparent
Component/s: General
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Medium
Reporter: Michael Vorburger Assignee: Michael Vorburger
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All



 Description   

Just discovered (more remembered actually, had hit this in a past life) that mockito-all is dangerous substance abuse, must always use mockito-core, everywhere; ODL parent could enforce?

One can find various posts re. this problem online; incl. e.g. https://github.com/mockito/mockito/issues/324)

This is the root cause of the following sudden post merge build failure of https://git.opendaylight.org/gerrit/#/c/44000/ e.g. on https://jenkins.opendaylight.org/releng/job/netvirt-verify-carbon-mvn33-openjdk8/2584/console :

08:15:01 addElanInterface(org.opendaylight.netvirt.elanmanager.tests.ElanServiceTest) Time elapsed: 3.258 sec <<< ERROR!
08:15:01 java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: org.hamcrest.Matcher.describeMismatch(Ljava/lang/Object;Lorg/hamcrest/Description;)V
08:15:01 at java.util.concurrent.FutureTask.report(FutureTask.java:122)
08:15:01 at java.util.concurrent.FutureTask.get(FutureTask.java:206)
08:15:01 at org.awaitility.core.ConditionAwaiter$1.run(ConditionAwaiter.java:160)
08:15:01 at java.lang.Thread.run(Thread.java:745)
08:15:01 Caused by: java.lang.NoSuchMethodError: org.hamcrest.Matcher.describeMismatch(Ljava/lang/Object;Lorg/hamcrest/Description;)V
08:15:01 at org.awaitility.core.AbstractHamcrestCondition.getMismatchMessage(AbstractHamcrestCondition.java:77)
08:15:01 at org.awaitility.core.AbstractHamcrestCondition.access$300(AbstractHamcrestCondition.java:25)
08:15:01 at org.awaitility.core.AbstractHamcrestCondition$1.eval(AbstractHamcrestCondition.java:55)
08:15:01 at org.awaitility.core.ConditionAwaiter$ConditionPoller.run(ConditionAwaiter.java:215)
08:15:01 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
08:15:01 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
08:15:01 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
08:15:01 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
08:15:01 ... 1 more

I can fix this short term, but I'm opening this issue to track a number of changes I'm going to be pushing related to this.

I'd also like to investigate whether it may be possible to use a maven enforcer rule to completely block usage of mockito-all anywhere in ODL (and switch all current uses of it over to mockito-core).

I'd also like to see if it may be possible to run duplicate class entry validation during all ODL builds.



 Comments   
Comment by Michael Vorburger [ 23/Jan/17 ]

See External References field for a number of Gerrits I'm raising re. this...

Comment by Stephen Kitt [ 23/Jan/17 ]

(In reply to Michael Vorburger from comment #0)
> Just discovered (more remembered actually, had hit this in a past life) that
> mockito-all is dangerous substance abuse, must always use mockito-core,
> everywhere; ODL parent could enforce?

Yes, we should enforce this once we've migrated everyone away (weather event...). This will also help with the migration to Mockito 2 which drops mockito-all.

Comment by Michael Vorburger [ 23/Jan/17 ]

> run duplicate class entry validation during all ODL builds

see https://git.opendaylight.org/gerrit/#/c/50908/

req. CONTROLLER-1578 as pre-req. first, to clean up duplicates.

> This will also help with the migration to Mockito 2 which drops mockito-all.

Yeah, that may be trivial after this - I'll have done all the hard work required for that under this here! E.g. things like adjusting https://git.opendaylight.org/gerrit/#/c/50861/

Comment by Michael Vorburger [ 14/Feb/17 ]

We had 5 unreactive/dead projects blocking progress on this front.

Today those 5 projects were removed from autorelease, see:

and:

With this mockito-all should now not be used anywhere in ODL anymore.

https://git.opendaylight.org/gerrit/#/c/50844/ can go next, then done.

Comment by Michael Vorburger [ 04/Sep/18 ]

This was fully done (AFAIK) a VERY LONG time ago, already; dunno why I had kept this issue open.

Generated at Wed Feb 07 20:27:31 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.