public void test_XMLToken_create() { XMLToken token; XMLTriple triple; XMLAttributes attr; token = new XMLToken(); assertTrue(token != null); token = null; triple = new XMLTriple("attr", "uri", "prefix"); token = new XMLToken(triple); assertTrue(token != null); assertTrue(("attr" != token.getName()) == false); assertTrue(("prefix" != token.getPrefix()) == false); assertTrue(("uri" != token.getURI()) == false); token = null; attr = new XMLAttributes(); assertTrue(attr != null); attr.add("attr2", "value"); token = new XMLToken(triple, attr); assertTrue(token != null); XMLAttributes returnattr = token.getAttributes(); assertTrue(("attr2" != returnattr.getName(0)) == false); token = null; triple = null; attr = null; }
public void test_XMLToken_newSetters_removeAttributes1() { XMLTriple triple = new XMLTriple("test", "", ""); XMLAttributes attr = new XMLAttributes(); XMLToken token = new XMLToken(triple, attr); XMLTriple xt2 = new XMLTriple("name3", "http://name3.org/", "p3"); XMLTriple xt1 = new XMLTriple("name5", "http://name5.org/", "p5"); int i = token.addAttr("name1", "val1"); i = token.addAttr("name2", "val2", "http://name1.org/", "p1"); i = token.addAttr(xt2, "val2"); i = token.addAttr("name4", "val4"); assertTrue(token.getAttributes().getLength() == 4); i = token.removeAttr(7); assertTrue(i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE); i = token.removeAttr("name7"); assertTrue(i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE); i = token.removeAttr("name7", "namespaces7"); assertTrue(i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE); i = token.removeAttr(xt1); assertTrue(i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE); assertTrue(token.getAttributes().getLength() == 4); i = token.removeAttr(3); assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS); assertTrue(token.getAttributes().getLength() == 3); i = token.removeAttr("name1"); assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS); assertTrue(token.getAttributes().getLength() == 2); i = token.removeAttr("name2", "http://name1.org/"); assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS); assertTrue(token.getAttributes().getLength() == 1); i = token.removeAttr(xt2); assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS); assertTrue(token.getAttributes().getLength() == 0); xt1 = null; xt2 = null; triple = null; attr = null; token = null; }