我正在尝试使用mockito core 3.8模拟一个预告类(公共接口),但我不能这样做。
我有JAVA 11,这是下面的错误:
org.mockito.exceptions.base.MockitoException:
Mockito cannot mock this class: interface com.adobe.cq.wcm.core.components.models.Teaser.
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 : 11
JVM vendor name : Oracle Corporation
JVM vendor version : 11.0.12+8-LTS-237
JVM name : Java HotSpot(TM) 64-Bit Server VM
JVM version : 11.0.12+8-LTS-237
JVM info : mixed mode
OS name : Windows 10
OS version : 10.0
Underlying exception : java.lang.IllegalStateException: Type not found: com.adobe.cq.wcm.core.components.internal.jackson.ComponentDataModelSerializer这是怎么回事?
发布于 2021-09-21 19:22:19
我终于找到了解决这个问题的办法。问题是我的项目没有wcm核心组件依赖。由于AEMaaCS将该依赖项作为包包含在内,因此我们不需要在项目中包含该依赖项。
我最终只为scope=test添加了依赖项。
https://stackoverflow.com/questions/69210157
复制相似问题