In AEM, there is a Java USE class wherein following code is present getWcmMode().isEdit()
Now, I am struggling to mock this object using mockito in Test java class. Is there any way we can do that?
In AEM, there is a Java USE class wherein following code is present getWcmMode().isEdit()
Now, I am struggling to mock this object using mockito in Test java class. Is there any way we can do that?
getWcmMode()is a final method inWCMUsePojo, mockito does not support mocking final methods by default.you will have to enable it by creating a file named
org.mockito.plugins.MockMakerin classpath (put it in the test resources/mockito-extensions folder) and put the following single linethen you can use
whento specify function return values as usual-