in core/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java [213:227]
void unregisterService(MockServiceRegistration<?> registration) {
if (log.isDebugEnabled()) {
Object componentInstance = registration.getService();
log.debug("Unregister {} ({}), bundleContext={}", componentInstance != null ? componentInstance.getClass() : "",
StringUtils.join(registration.getClasses(), ","), this);
}
boolean wasRemoved = this.registeredServices.remove(registration);
if (wasRemoved) {
handleRefsUpdateOnUnregister(registration);
notifyServiceListeners(ServiceEvent.UNREGISTERING, registration.getReference());
} else {
throw new IllegalStateException("Service was already unregistered");
}
}