This class is Foo:
public class Foo {
private Unmarshaller unmarshaller;
public Foo(Unmarshaller unmarshaller) {}
}
The following tests failed:
@Test
public void test() {
Foo packagingJobSource2 = mock(Foo.class);
}
... with an error:
org.mockito.exceptions.base.MockitoException:
Mockito cannot mock this class: class com.bell.cts.fonse.vod.streaming.services.adapter.cron.avcm.packagingjob.loading.xmlstorage.Foo.
Mockito can only mock non-private & non-final classes.
If you're not sure why you're getting this error, please report to the mailing list.
Java : 9
JVM vendor name : Oracle Corporation
JVM vendor version : 9.0.1+11
JVM name : Java HotSpot(TM) 64-Bit Server VM
JVM version : 9.0.1+11
JVM info : mixed mode
OS name : Mac OS X
OS version : 10.13.2
I tried using JDK 8 instead of 9 and it works fine. I don’t know why this will fail, and not how I can do this work.
The problem arises when it Unmarshaller
is addiction. If you change it to another type, for example String
, it works ...
source
share