public abstract class AbstractRendererForTestingIntegrationService implements Renderer {
protected void injectComponent(String tag, Map<String, Object> attributes, String localId, String locatorDomId,
Appendable out, boolean useAsync, String applicationTag) throws AuraRuntimeException, QuickFixException, IOException {
ContextService contextService = Aura.getContextService();
AuraContext ctx = contextService.getCurrentContext();
contextService.endContext();
Integration integration = Aura.getIntegrationService().createIntegration(
"", Mode.DEV, true, null, applicationTag, null);
integration.injectComponent(tag, attributes, localId, locatorDomId, out, useAsync);
// The only not-so-ideal part of this approach to testing
// IntegrationService is that we have to start the
// context for the rendering of the original stub component to continue.
// IntegrationService sets up and tears down its context.
contextService.startContext(ctx.getMode(), ctx.getFormat(), ctx.getAccess(),
ctx.getApplicationDescriptor());
}