}
@Test
public void testOneEJBDeploy() throws Exception
{
EJBsDeployer deployer = new EJBsDeployer();
DeploymentUnit unit = mock(DeploymentUnit.class);
JBossMetaData metaData = new JBossMetaData();
metaData.setEjbVersion("3.0");
JBossEnterpriseBeansMetaData enterpriseBeans = new JBossEnterpriseBeansMetaData();
JBossSessionBeanMetaData sessionBean = new JBossSessionBeanMetaData();
sessionBean.setEjbName("Test");
enterpriseBeans.add(sessionBean);
metaData.setEnterpriseBeans(enterpriseBeans);
when(unit.getAttachment(AttachmentNames.PROCESSED_METADATA, JBossMetaData.class)).thenReturn(metaData);
DeploymentUnit component = mock(DeploymentUnit.class);
when(unit.addComponent(JBossEnterpriseBeanMetaData.class.getName() + ".Test")).thenReturn(component);
deployer.deploy(unit);
// make sure the deployer actually looked at the metadata
verify(unit).getAttachment(AttachmentNames.PROCESSED_METADATA, JBossMetaData.class);
// make sure the component got created
verify(unit).addComponent(JBossEnterpriseBeanMetaData.class.getName() + ".Test");