I have a configuration property class, annotated with @ConstructorBinding
to make it immutable. But while running test cases, this is not getting mocked.
@ConfigurationProperties
@ConstructorBinding
@lombok.Value
class PropertyConfig{
// some code
}
While running the test classes, I'm getting the following error:
org.mockito.exceptions.base.MockitoException:
Cannot mock/spy class com.packagename.PropertyConfig
Mockito cannot mock/spy because :
- final class
at
How to fix this error?