in core/src/main/java/org/apache/sling/testing/mock/osgi/OsgiServiceUtil.java [117:137]
public static boolean modified(Object target, MockComponentContext componentContext, Map<String,Object> properties) {
Class<?> targetClass = target.getClass();
// get method name for activation/deactivation from osgi metadata
OsgiMetadata metadata = OsgiMetadataUtil.getMetadata(targetClass);
if (metadata == null) {
throw new NoScrMetadataException(targetClass);
}
String methodName = metadata.getModifiedMethodName();
if (StringUtils.isEmpty(methodName)) {
return false;
}
// try to find matching modified method and execute it
if (invokeLifecycleMethod(target, targetClass, methodName, false, componentContext, properties)) {
return true;
}
throw new RuntimeException("No matching modified method with name '" + methodName + "' "
+ " found in class " + targetClass.getName());
}