CitrusRemoteInstanceProducer { public void beforeSuite(@Observes(precedence = CitrusExtensionConstants.INSTANCE_REMOTE_PRECEDENCE) BeforeSuite event) { try { log.info("Producing Citrus framework instance"); citrusInstance.set(Citrus.newInstance(CitrusSpringContext.create(configurationInstance.get().getConfigurationClass()))); } catch (Exception e) { log.error(CitrusExtensionConstants.CITRUS_EXTENSION_ERROR, e); throw e; } }  void beforeSuite(@Observes(precedence = CitrusExtensionConstants.INSTANCE_REMOTE_PRECEDENCE) BeforeSuite event);  }
@Test public void testCreateInstance() throws Exception { reset(instanceProducer, configurationInstance); when(configurationInstance.get()).thenReturn(configuration); doAnswer(invocation -> { Citrus citrus = (Citrus) invocation.getArguments()[0]; Assert.assertNotNull(citrus); return null; }).when(instanceProducer).set(any(Citrus.class)); InjectionHelper.inject(citrusInstanceProducer, "citrusInstance", instanceProducer); InjectionHelper.inject(citrusInstanceProducer, "configurationInstance", configurationInstance); citrusInstanceProducer.beforeSuite(new BeforeSuite()); }