Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

How to write a junit for activate and deactivate method?

Avatar

Level 1
 
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Please refer this document :
https://sling.apache.org/documentation/development/osgi-mock.html#activation-and-dependency-injectio...

// activate service

MockOsgi.activate(service, props);

 // deactivate service

MockOsgi.deactivate(service);

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Please refer this document :
https://sling.apache.org/documentation/development/osgi-mock.html#activation-and-dependency-injectio...

// activate service

MockOsgi.activate(service, props);

 // deactivate service

MockOsgi.deactivate(service);