Mockito cannot mock this class: class cz.cvut.kbss.jsonld.deserialization.InstanceContext.
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 : 1.8
JVM vendor name : Oracle Corporation
JVM vendor version : 25.201-b09
JVM name : Java HotSpot(TM) 64-Bit Server VM
JVM version : 1.8.0_201-b09
JVM info : mixed mode
OS name : Linux
OS version : 4.9.0-14-amd64
Underlying exception : org.mockito.exceptions.base.MockitoException:
Cannot create mock for class cz.cvut.kbss.jsonld.deserialization.InstanceContext
The type is not public and its mock class is loaded by a different class loader.
This can have multiple reasons:
- You are mocking a class with additional interfaces of another class loader
- Mockito is loaded by a different class loader than the mocked type (e.g. with OSGi)
- The thread's context class loader is different than the mock's class loader
Stack Trace
org.mockito.exceptions.base.MockitoException:
Mockito cannot mock this class: class cz.cvut.kbss.jsonld.deserialization.InstanceContext.
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 : 1.8
JVM vendor name : Oracle Corporation
JVM vendor version : 25.201-b09
JVM name : Java HotSpot(TM) 64-Bit Server VM
JVM version : 1.8.0_201-b09
JVM info : mixed mode
OS name : Linux
OS version : 4.9.0-14-amd64
Underlying exception : org.mockito.exceptions.base.MockitoException:
Cannot create mock for class cz.cvut.kbss.jsonld.deserialization.InstanceContext
The type is not public and its mock class is loaded by a different class loader.
This can have multiple reasons:
- You are mocking a class with additional interfaces of another class loader
- Mockito is loaded by a different class loader than the mocked type (e.g. with OSGi)
- The thread's context class loader is different than the mock's class loader
at cz.cvut.kbss.jsonld.deserialization.NodeReferenceContextTest.setUp(NodeReferenceContextTest.java:42)
Caused by: org.mockito.exceptions.base.MockitoException:
Cannot create mock for class cz.cvut.kbss.jsonld.deserialization.InstanceContext
The type is not public and its mock class is loaded by a different class loader.
This can have multiple reasons:
- You are mocking a class with additional interfaces of another class loader
- Mockito is loaded by a different class loader than the mocked type (e.g. with OSGi)
- The thread's context class loader is different than the mock's class loader
at cz.cvut.kbss.jsonld.deserialization.NodeReferenceContextTest.setUp(NodeReferenceContextTest.java:42)