public void test_Reaction_addProduct1() { Reaction m = new Reaction(2,2); SpeciesReference p = new SpeciesReference(2,2); SpeciesReference p1 = new SpeciesReference(2,2); p1.setSpecies( "k"); p1.setId( "k1"); int i = m.addProduct(p); assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT ); p.setSpecies( "k"); p.setId( "k1"); i = m.addProduct(p); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertTrue( m.getNumProducts() == 1 ); i = m.addProduct(p1); assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID ); assertTrue( m.getNumProducts() == 1 ); p = null; p1 = null; m = null; }
public void test_Reaction_addProduct3() { Reaction m = new Reaction(2,2); SpeciesReference p = new SpeciesReference(1,2); p.setSpecies( "k"); int i = m.addProduct(p); assertTrue( i == libsbml.LIBSBML_LEVEL_MISMATCH ); assertTrue( m.getNumProducts() == 0 ); p = null; m = null; }
public void test_SpeciesReference_Product_parent_add() { SpeciesReference sr = new SpeciesReference(2,4); Reaction r = new Reaction(2,4); sr.setSpecies("p"); r.addProduct(sr); sr = null; ListOf lo = r.getListOfProducts(); assertTrue( lo == r.getProduct(0).getParentSBMLObject() ); assertTrue( r == lo.getParentSBMLObject() ); }
public void test_Reaction_addProduct4() { Reaction m = new Reaction(2,2); SpeciesReference p = null; int i = m.addProduct(p); assertTrue( i == libsbml.LIBSBML_OPERATION_FAILED ); assertTrue( m.getNumProducts() == 0 ); m = null; }
public void test_SpeciesReference_Product_ancestor_add() { SpeciesReference sr = new SpeciesReference(2,4); Reaction r = new Reaction(2,4); sr.setSpecies("p"); r.addProduct(sr); sr = null; ListOf lo = r.getListOfProducts(); SpeciesReference obj = r.getProduct(0); assertTrue( obj.getAncestorOfType(libsbml.SBML_REACTION) == r ); assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo ); assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null ); assertTrue( obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null ); }