public void testInstantiateObject() throws Exception { Object obj = DynamicUtil.instantiateObject("org.intermine.model.testmodel.Manager", "org.intermine.model.testmodel.Broke"); assertTrue(obj instanceof Manager); assertTrue(obj instanceof Broke); }
public void testCreateObjectOneInterfaceWithParents() throws Exception { Object obj = DynamicUtil.createObject(Collections.singleton(Employable.class)); assertTrue(obj instanceof Employable); assertTrue(obj instanceof Thing); }
public void testCreateObjectClassAndRedundantInterfaces() { Set intSet = new HashSet(); intSet.add(Employee.class); intSet.add(Employable.class); Object obj = DynamicUtil.createObject(intSet); assertEquals(Employee.class, obj.getClass()); assertTrue(obj instanceof Employee); assertTrue(obj instanceof Employable); }
public void testClassHeirarchyBrokeCEOIsCEO() throws Exception { Class brokeCEO = DynamicUtil.composeClass(new HashSet(Arrays.asList(new Class[] {Broke.class, CEO.class}))); assertTrue(CEO.class.isAssignableFrom(brokeCEO)); }
public void testInstantiateObjectNullClassName() throws Exception { Object obj = DynamicUtil.instantiateObject(null, "org.intermine.model.testmodel.Broke"); assertTrue(obj instanceof Broke); }
public void testInstantiateObjectEmptyClassName() throws Exception { Object obj = DynamicUtil.instantiateObject("", "org.intermine.model.testmodel.Broke"); assertTrue(obj instanceof Broke); }
public void testClassHeirarchyBrokeCEOIsBroke() throws Exception { Class brokeCEO = DynamicUtil.composeClass(new HashSet(Arrays.asList(new Class[] {Broke.class, CEO.class}))); assertTrue(Broke.class.isAssignableFrom(brokeCEO)); }
public void testInstantiateObjectNullImplementations() throws Exception { Object obj = DynamicUtil.instantiateObject("org.intermine.model.testmodel.Manager", null); assertTrue(obj instanceof Manager); }
public void testInstantiateObjectEmptyImplementations() throws Exception { Object obj = DynamicUtil.instantiateObject("org.intermine.model.testmodel.Manager", ""); assertTrue(obj instanceof Manager); }
public void testCreateObjectNoClassTwoInterfaces() throws Exception { Set intSet = new HashSet(); intSet.add(Company.class); intSet.add(Broke.class); Object obj = DynamicUtil.createObject(intSet); assertTrue(obj instanceof Company); assertTrue(obj instanceof RandomInterface); assertTrue(obj instanceof Broke); assertTrue(obj instanceof HasSecretarys); assertTrue(obj instanceof HasAddress); ((Company) obj).setName("Wotsit"); ((Broke) obj).setDebt(40); assertEquals("Wotsit", ((Company) obj).getName()); assertEquals(40, ((Broke) obj).getDebt()); }
public void testCreateObjectClassInterfaces() throws Exception { Set intSet = new HashSet(); intSet.add(Manager.class); intSet.add(Broke.class); Object obj = DynamicUtil.createObject(intSet); assertTrue(obj instanceof Manager); assertTrue(obj instanceof Employee); assertTrue(obj instanceof ImportantPerson); assertTrue(obj instanceof Employable); assertTrue(obj instanceof HasAddress); assertTrue(obj instanceof Broke); Manager m = (Manager) obj; m.setName("Frank"); m.setTitle("Mr."); ((Broke) m).setDebt(30); assertEquals("Frank", m.getName()); assertEquals("Mr.", m.getTitle()); assertEquals(30, ((Broke) m).getDebt()); }
public void testCreateObjectOneInterface() throws Exception { Object obj = DynamicUtil.createObject(Collections.singleton(Company.class)); assertTrue(obj instanceof Company); Company c = (Company) obj; c.setName("Flibble"); assertEquals("Flibble", c.getName()); }