public void test_UnitDefinition_clone() { UnitDefinition o1 = new UnitDefinition(2, 4); o1.setId("c"); assertTrue(o1.getId() == "c"); UnitDefinition o2 = o1.clone(); assertTrue(o2.getId() == "c"); assertTrue(o2.getParentSBMLObject() == o1.getParentSBMLObject()); o2 = null; o1 = null; }
public void test_UnitDefinition_parent_NULL() { SBMLDocument d = new SBMLDocument(); Model m = d.createModel(); UnitDefinition c = m.createUnitDefinition(); Unit u = c.createUnit(); assertTrue(u.getAncestorOfType(libsbml.SBML_UNIT_DEFINITION) == c); UnitDefinition c1 = c.clone(); d = null; assertTrue(c1.getAncestorOfType(libsbml.SBML_MODEL) == null); assertTrue(c1.getParentSBMLObject() == null); assertEquals(c1.getSBMLDocument(), null); assertTrue(c1.getUnit(0).getAncestorOfType(libsbml.SBML_UNIT_DEFINITION) == c1); assertTrue(c1.getUnit(0).getParentSBMLObject() != null); assertEquals(c1.getUnit(0).getSBMLDocument(), null); c1 = null; }