new EntityBeanConverter(jdtFacade).addRelationshipAnnotations(appModule);
}
public void testAddAnnotationsForManyToOneRelationship() throws Exception {
Mockery context = new Mockery();
final IJDTFacade jdtFacade = context.mock(IJDTFacade.class);
InputStream is = getClass().getResourceAsStream("manytoone-ejb-jar.xml");
InputSource ejbJarSrc = new InputSource(is);
AppModule appModule = new TestFixture().getAppModule(ejbJarSrc, null);
context.checking(new Expectations() {
{
Map<String, Object> oneToManyProperties = new HashMap<String,Object>();
oneToManyProperties.put("targetEntity", "org.superbiz.ProductBean");
one(jdtFacade).addMethodAnnotation("org.superbiz.OrderLineBean", "getProduct", new String[0], ManyToOne.class, oneToManyProperties);
Map<String, Object> manyToOneProperties = new HashMap<String,Object>();
manyToOneProperties.put("targetEntity", "org.superbiz.OrderLineBean");
one(jdtFacade).addMethodAnnotation("org.superbiz.ProductBean", "getOrderLine", new String[0], OneToMany.class, manyToOneProperties);
}
});
new EntityBeanConverter(jdtFacade).addRelationshipAnnotations(appModule);
context.assertIsSatisfied();
}