public void test_Constraint_createWithNS() { XMLNamespaces xmlns = new XMLNamespaces(); xmlns.add( "http://www.sbml.org", "testsbml"); SBMLNamespaces sbmlns = new SBMLNamespaces(2,2); sbmlns.addNamespaces(xmlns); Constraint object1 = new Constraint(sbmlns); assertTrue( object1.getTypeCode() == libsbml.SBML_CONSTRAINT ); assertTrue( object1.getMetaId() == "" ); assertTrue( object1.getNotes() == null ); assertTrue( object1.getAnnotation() == null ); assertTrue( object1.getLevel() == 2 ); assertTrue( object1.getVersion() == 2 ); assertTrue( object1.getNamespaces() != null ); assertTrue( object1.getNamespaces().getLength() == 2 ); object1 = null; }
public void test_Constraint_copyConstructor() { Constraint o1 = new Constraint(2,4); o1.setMetaId("c"); assertTrue( o1.getMetaId() == "c" ); XMLNode text = XMLNode.convertStringToXMLNode(" Some text "); XMLTriple triple = new XMLTriple("p", "http://www.w3.org/1999/xhtml", ""); XMLAttributes att = new XMLAttributes(); XMLNamespaces xmlns = new XMLNamespaces(); xmlns.add("http://www.w3.org/1999/xhtml"); XMLNode p = new XMLNode(triple,att,xmlns); p.addChild(text); XMLTriple triple1 = new XMLTriple("message", "", ""); XMLAttributes att1 = new XMLAttributes(); XMLNode message = new XMLNode(triple1,att1); message.addChild(p); ASTNode math = new ASTNode(libsbml.AST_CONSTANT_PI); o1.setMath(math); o1.setMessage(message); math = null; message = null; XMLNode msg; assertTrue( o1.getMath() != null ); msg = o1.getMessage(); assertTrue( msg != null ); Constraint o2 = new Constraint(o1); assertTrue( o2.getMetaId() == "c" ); assertTrue( o2.getMath() != null ); msg = o2.getMessage(); assertTrue( msg != null ); assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() ); o2 = null; o1 = null; }