Platinum Partner
java,mockito final

How to "Mock" Final Classes With Mockito

 If you are using mockito, then you cannot "mock" final classes. But there is a nice library called JDave which does some bytecode, i.e. CGLIB, magic to change final classes to non-final classes.

Just download JDave, add the JAR files to the classpath, and start your test cases with the following VM option:

-javaagent:your-library-directory\jdave-unfinalizer-1.1.jar

 

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}