### Question:
EJBOperations { public JavaClassSource setupMessageDrivenBean(JavaClassSource ejb, JMSDestinationType destType, String destName) { Assert.notNull(destType, "JMS Destination type must not be null when bean is Message Driven"); Assert.notNull(destName, "JMS Destination name must not be null when bean is Message Driven"); AnnotationSource<JavaClassSource> annotation = ejb.getAnnotation(EJBType.MESSAGEDRIVEN.getAnnotation()); if (annotation == null) { annotation = ejb.addAnnotation(EJBType.MESSAGEDRIVEN.getAnnotation()); } if (destType != null && destName != null) { ejb.addImport(ActivationConfigProperty.class); ejb.addImport(Message.class); ejb.implementInterface(MessageListener.class); annotation.setLiteralValue("name", "\"" + ejb.getName() + "\"") .setLiteralValue( "activationConfig", "{@ActivationConfigProperty(propertyName = \"destinationType\", propertyValue = \"" + destType.getDestinationType() + "\"), " + "@ActivationConfigProperty(propertyName = \"destination\", propertyValue = \"" + destName + "\")" + "}"); } return ejb; }  JavaResource newEJB(
            final Project project,
            final String ejbName,
            final String targetPackage,
            final EJBType ejbType,
            final boolean serializable); JavaResource newEJB(DirectoryResource target,
            final String ejbName,
            final String ejbPackage,
            final EJBType ejbType,
            final boolean serializable); JavaClassSource setupMessageDrivenBean(JavaClassSource ejb, JMSDestinationType destType, String destName); boolean isEJB(JavaType<?> javaType); void addActivationConfigProperty(JavaClassSource ejb, String name, String value); void removeActivationConfigProperty(JavaClassSource target, String name);  }### Answer:
@Test public void testSetupMessageDrivenBean() { JavaClassSource mdb = Roaster.create(JavaClassSource.class).setName("FooMDB"); ejbOp.setupMessageDrivenBean(mdb, JMSDestinationType.QUEUE, "queue/foo"); Assert.assertThat(mdb.hasAnnotation(MessageDriven.class), is(true)); Assert.assertThat(mdb.getInterfaces(), hasItem("javax.jms.MessageListener")); AnnotationSource<JavaClassSource> annotation = mdb.getAnnotation(MessageDriven.class); AnnotationSource<JavaClassSource> configs[] = annotation.getAnnotationArrayValue("activationConfig"); Assert.assertThat(configs.length, equalTo(2)); Assert.assertThat(configs[0].getStringValue("propertyName"), equalTo("destinationType")); Assert.assertThat(configs[0].getStringValue("propertyValue"), equalTo("javax.jms.Queue")); Assert.assertThat(configs[1].getStringValue("propertyName"), equalTo("destination")); Assert.assertThat(configs[1].getStringValue("propertyValue"), equalTo("queue/foo")); }