You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mockito cannot mock this class: class pl.inpost.recruitmenttask.presentation.shipmentList.Section$HasId.
If you're not sure why you're getting this error, please open an issue on GitHub.
Java : 17
JVM vendor name : Amazon.com Inc.
JVM vendor version : 17.0.8+7-LTS
JVM name : OpenJDK 64-Bit Server VM
JVM version : 17.0.8+7-LTS
JVM info : mixed mode, sharing
OS name : Windows 10
OS version : 10.0
and here's the class:
importpl.inpost.recruitmenttask.presentation.components.CourierPackageItemimportpl.inpost.recruitmenttask.presentation.components.HeaderItemimportpl.inpost.recruitmenttask.presentation.components.ParcelLockerItemsealedinterfaceSection {
sealedclassHasId(
valid:String
)
data classSectionHeader(valmodel:HeaderItem.Model) : Section
data classSectionItemCourier(valmodel:CourierPackageItem.Model) : Section,
HasId(model.number)
data classSectionItemParcelLocker(valmodel:ParcelLockerItem.Model) : Section,
HasId(model.number)
}
The text was updated successfully, but these errors were encountered:
I faced same issue with mocking final class after updating mockito kotlin from 4.1.0 to 5.1.0. I mock class that has such hierarchy:
interface Interface
abstract class BaseClass: Interface
abstract class BaseTypedClass: BaseClass
class ImplClass : BaseTypedClass
When I mock ImplClass I got this error:
Mockito cannot mock this class: class ru.gibdd_pay.app.utils.experimentalFeatureManager.experiments.KaskoTabExperiment.
Can not mock final classes with the following settings :
- explicit serialization (e.g. withSettings().serializable())
- extra interfaces (e.g. withSettings().extraInterfaces(...))
When I mock BaseTypedClass<Type> I got this error:
Mockito cannot mock this class: class ru.gibdd_pay.app.utils.experimentalFeatureManager.core.RemoteNewOldUsersExperiment.
If you're not sure why you're getting this error, please open an issue on GitHub.
Java : 17
JVM vendor name : Amazon.com Inc.
JVM vendor version : 17.0.8.1+8-LTS
JVM name : OpenJDK 64-Bit Server VM
JVM version : 17.0.8.1+8-LTS
JVM info : mixed mode, sharing
OS name : Mac OS X
OS version : 13.5.2
You are seeing this disclaimer because Mockito is configured to create inlined mocks.
You can learn about inline mocks and their limitations under item #39 of the Mockito class javadoc.
At the end of error message I saw this, seems it is a problem: Mismatch of count of formal and actual type arguments in constructor of com.package.ImplClass$classField$1: 0 formal argument(s) 1 actual argument(s)
Successfully fixed this by explicitly specifying type of classField. Before it just was initialized with anonymous object of type BaseClass.
Java : 21
JVM vendor name : Amazon.com Inc.
JVM vendor version : 21.0.2+13-LTS
JVM name : OpenJDK 64-Bit Server VM
JVM version : 21.0.2+13-LTS
JVM info : mixed mode, sharing
OS name : Mac OS X
OS version : 14.1.2
Mockito cannot mock this class: class pl.inpost.recruitmenttask.presentation.shipmentList.Section$HasId.
If you're not sure why you're getting this error, please open an issue on GitHub.
Java : 17
JVM vendor name : Amazon.com Inc.
JVM vendor version : 17.0.8+7-LTS
JVM name : OpenJDK 64-Bit Server VM
JVM version : 17.0.8+7-LTS
JVM info : mixed mode, sharing
OS name : Windows 10
OS version : 10.0
and here's the class:
The text was updated successfully, but these errors were encountered: