/** * */ package net.sf.dobo; import junit.framework.TestCase; import net.sf.dobo.sample.BusinessLogic; import net.sf.dobo.sample.BusinessLogicContext; import net.sf.dobo.sample.BusinessLogicImplementationObject; import net.sf.dobo.sample.MyLogic; import net.sf.dobo.sample.MyLogicContext; import net.sf.dobo.sample.MyLogicContextObject; import net.sf.dobo.sample.checkfailed.BusinessContext; import net.sf.dobo.sample.checkfailed.BusinessContextImplementationObject; /** * @author arif * */ public class DoboUtilsTest extends TestCase { /** * Test Check */ public void testCheck() { Dobo.check(BusinessContextImplementationObject.class); } /** * Test get method */ public void testGetMethodAnnotatedWith() { assertNotNull(Dobo.getMethodAnnotatedWith(BusinessContext.actionOne.class, BusinessContextImplementationObject.class)); assertNotNull(Dobo.getMethodAnnotatedWith(BusinessContext.ACTION_TWO.class, BusinessContextImplementationObject.class)); assertNotNull(Dobo.getMethodAnnotatedWith(BusinessContext.ACTION_THREE.class, BusinessContextImplementationObject.class)); assertNotNull(Dobo.getMethodAnnotatedWith(BusinessContext.ACTION_FOUR.class, BusinessContextImplementationObject.class)); assertNotNull(Dobo.getMethodAnnotatedWith(BusinessContext.add.class, BusinessContextImplementationObject.class)); assertNotNull(Dobo.getMethodAnnotatedWith(BusinessContext.div.class, BusinessContextImplementationObject.class)); assertNotNull(Dobo.getMethodAnnotatedWith(BusinessContext.multiply.class, BusinessContextImplementationObject.class)); } /** * Test instantiate * */ public void testInstantiate() throws InstantiationException, IllegalAccessException { BusinessLogic businessLogic = (BusinessLogic) Dobo.instantiate(new BusinessLogicImplementationObject(), BusinessLogicContext.class); businessLogic.callingName(); MyLogic myLogic = (MyLogic) Dobo.instantiate(new MyLogicContextObject(), MyLogicContext.class); myLogic.hey(); } /** * Test get interface method */ public void testGetInterfaceMethodMatchWith() { assertNotNull(Dobo.getInterfaceMethodMatchWith("add", new Class[] { int.class, int.class }, BusinessContextImplementationObject.class)); } }