3

I'm having issue getting the mock-maker-inline to work. I followed the instructions on

enter image description here

However, i still can't mock out a final class. I also tried out the example in the document. I was wondering if there is anyway to debug what went wrong?

org.mockito.exceptions.base.MockitoException: 
Cannot mock/spy class Tests$1FinalClass
Mockito cannot mock/spy because :
 - final class

I'm on mockito org.mockito:mockito-core:3.1.0 and using

java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)

Thanks, Derek

darewreck
  • 2,576
  • 5
  • 42
  • 67
  • You might want to add some information about your project structure and where you created the file. Works for me, if you leave out the `resources` folder and put the `mockito-extensions` folder directly into the `test source` folder. – second Oct 06 '19 at 19:44
  • I had similar issue, but making use of PowerMockito and turning on mock-maker-inline as specified in this link https://github.com/powermock/powermock-examples-maven/blob/master/mockito2/src/test/resources/org/powermock/extensions/configuration.properties helped me – DecKno Feb 17 '20 at 18:01

0 Answers0