JmsEnvelopeSenderProducer { @Produces public JmsEnvelopeSender createJmsEnvelopeSender(final InjectionPoint injectionPoint) { if (componentNameExtractor.hasComponentAnnotation(injectionPoint) && !isCommandController(injectionPoint)) { return new ShutteringJmsEnvelopeSender(envelopeSenderSelector); } return new DefaultJmsEnvelopeSender(jmsSender); }  @Produces JmsEnvelopeSender createJmsEnvelopeSender(final InjectionPoint injectionPoint);  }
@Test public void shouldProduceShutteringJmsEnvelopeSenderForQueryApiComponent() { final JmsEnvelopeSender jmsEnvelopeSender = jmsEnvelopeSenderProducer.createJmsEnvelopeSender(adaptorQueryApiInjectionPoint); assertThat(jmsEnvelopeSender, is(instanceOf(ShutteringJmsEnvelopeSender.class))); }
@Test public void shouldProduceShutteringJmsEnvelopeSenderForEventProcessorComponent() { final JmsEnvelopeSender jmsEnvelopeSender = jmsEnvelopeSenderProducer.createJmsEnvelopeSender(adaptorEventProcessorInjectionPoint); assertThat(jmsEnvelopeSender, is(instanceOf(ShutteringJmsEnvelopeSender.class))); }
@Test public void shouldProduceDefaultJmsEnvelopeSenderWhenCommandControllerAnnotation() { final JmsEnvelopeSender jmsEnvelopeSender = jmsEnvelopeSenderProducer.createJmsEnvelopeSender(adaptorCommandControllerInjectionPoint); assertThat(jmsEnvelopeSender, is(instanceOf(DefaultJmsEnvelopeSender.class))); }
@Test public void shouldProduceDefaultJmsEnvelopeSenderWhenNoComponentAnnotation() { final JmsEnvelopeSender jmsEnvelopeSender = jmsEnvelopeSenderProducer.createJmsEnvelopeSender(noAnnotationInjectionPoint); assertThat(jmsEnvelopeSender, is(instanceOf(DefaultJmsEnvelopeSender.class))); }
@Test public void shouldReturnTheDifferentJmsEnvelopeSenderForTwoInjectionPoints() throws Exception { final JmsEnvelopeSender jmsEnvelopeSender_1 = jmsEnvelopeSenderProducer.createJmsEnvelopeSender(adaptorCommandApiInjectionPointA); final JmsEnvelopeSender jmsEnvelopeSender_2 = jmsEnvelopeSenderProducer.createJmsEnvelopeSender(adaptorCommandApiInjectionPointB); assertThat(jmsEnvelopeSender_1, is(not(sameInstance(jmsEnvelopeSender_2)))); }
@Test public void shouldReturnDifferentJmsEnvelopeSenderForCommandApiAndQueryApiInjectionPoints() throws Exception { final JmsEnvelopeSender jmsEnvelopeSender_1 = jmsEnvelopeSenderProducer.createJmsEnvelopeSender(adaptorCommandApiInjectionPointA); final JmsEnvelopeSender jmsEnvelopeSender_2 = jmsEnvelopeSenderProducer.createJmsEnvelopeSender(adaptorQueryApiInjectionPoint); assertThat(jmsEnvelopeSender_1, is(not(sameInstance(jmsEnvelopeSender_2)))); }