public void test_XMLToken_newSetters_clearNamespaces1() { XMLTriple triple = new XMLTriple("test","",""); XMLAttributes attr = new XMLAttributes(); XMLToken token = new XMLToken(triple,attr); XMLNamespaces ns = new XMLNamespaces(); assertTrue( token.getNamespacesLength() == 0 ); assertTrue( token.isNamespacesEmpty() == true ); ns.add( "http://test1.org/", "test1"); int i = token.setNamespaces(ns); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertTrue( token.getNamespacesLength() == 1 ); assertTrue( token.isNamespacesEmpty() == false ); i = token.clearNamespaces(); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertTrue( token.getNamespacesLength() == 0 ); assertTrue( token.isNamespacesEmpty() == true ); attr = null; triple = null; token = null; ns = null; }
public void test_XMLToken_namespace_set_clear() { XMLTriple triple = new XMLTriple("test","",""); XMLAttributes attr = new XMLAttributes(); XMLToken token = new XMLToken(triple,attr); XMLNamespaces ns = new XMLNamespaces(); assertTrue( token.getNamespacesLength() == 0 ); assertTrue( token.isNamespacesEmpty() == true ); ns.add( "http://test1.org/", "test1"); ns.add( "http://test2.org/", "test2"); ns.add( "http://test3.org/", "test3"); ns.add( "http://test4.org/", "test4"); ns.add( "http://test5.org/", "test5"); token.setNamespaces(ns); assertTrue( token.getNamespacesLength() == 5 ); assertTrue( token.isNamespacesEmpty() == false ); assertTrue( ( "test1" != token.getNamespacePrefix(0) ) == false ); assertTrue( ( "test2" != token.getNamespacePrefix(1) ) == false ); assertTrue( ( "test3" != token.getNamespacePrefix(2) ) == false ); assertTrue( ( "test4" != token.getNamespacePrefix(3) ) == false ); assertTrue( ( "test5" != token.getNamespacePrefix(4) ) == false ); assertTrue( ( "http://test1.org/" != token.getNamespaceURI(0) ) == false ); assertTrue( ( "http://test2.org/" != token.getNamespaceURI(1) ) == false ); assertTrue( ( "http://test3.org/" != token.getNamespaceURI(2) ) == false ); assertTrue( ( "http://test4.org/" != token.getNamespaceURI(3) ) == false ); assertTrue( ( "http://test5.org/" != token.getNamespaceURI(4) ) == false ); token.clearNamespaces(); assertTrue( token.getNamespacesLength() == 0 ); ns = null; token = null; triple = null; attr = null; }