CitrusExtension implements LoadableExtension { @Override public void register(ExtensionBuilder builder) { if (Validate.classExists(CitrusExtensionConstants.CITRUS)) { log.info("Citrus extension is active"); builder.service(AuxiliaryArchiveAppender.class, CitrusArchiveAppender.class); builder.service(ApplicationArchiveProcessor.class, CitrusArchiveProcessor.class); builder.service(TestEnricher.class, CitrusTestEnricher.class); builder.observer(CitrusConfigurationProducer.class); builder.observer(CitrusInstanceProducer.class); builder.observer(CitrusLifecycleHandler.class); } }  @Override void register(ExtensionBuilder builder);  }
@Test public void testRegister() throws Exception { LoadableExtension.ExtensionBuilder extensionBuilder = Mockito.mock(LoadableExtension.ExtensionBuilder.class); when(extensionBuilder.service(AuxiliaryArchiveAppender.class, CitrusArchiveAppender.class)).thenReturn(extensionBuilder); when(extensionBuilder.service(ApplicationArchiveProcessor.class, CitrusArchiveProcessor.class)).thenReturn(extensionBuilder); when(extensionBuilder.service(TestEnricher.class, CitrusTestEnricher.class)).thenReturn(extensionBuilder); when(extensionBuilder.observer(CitrusConfigurationProducer.class)).thenReturn(extensionBuilder); when(extensionBuilder.observer(CitrusInstanceProducer.class)).thenReturn(extensionBuilder); when(extensionBuilder.observer(CitrusLifecycleHandler.class)).thenReturn(extensionBuilder); extension.register(extensionBuilder); }