Highlighted

Mock Configuration Admin

Vabs95

07-10-2019

Hi,

I am writing Unit Test Cases for Sling Models, I have a function that gets Configurations from ConfigurationAdmin.listConfiguration() method. I'm using Junit 5 and Aem Mock for testing. How can I mock "listConfiguration()" method since currently an exception is thrown "java.lang.UnsupportedOperationException";

I tried by using spy and return mocked object whenever this function is called but still I get the same error.

Replies