Given class Foo:
public class Foo {
  private Unmarshaller unmarshaller;
  public Foo(Unmarshaller unmarshaller) {}
}
Following test fails:
@Test
public void test() {
  Foo packagingJobSource2 = mock(Foo.class);
}
...with 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've no idea why it would fail and neither how I can make this work.
The issue happens specifically when Unmarshaller is a dependency. If you change it for another type like String it works...
 
     
    