* Tests the construct XML function which is used to insert gadgets into wave
* XML representation.
*/
public void testConstructXml() {
String xmlSource = "http://test.com/gadget.xml";
XmlStringBuilder builder = GadgetXmlUtil.constructXml(xmlSource, "", LOGIN_NAME);
String xml = builder.toString();
String expectedValue = "<" + TAGNAME +
" " + URL_ATTRIBUTE + "=\"" + xmlSource + "\"" +
" " + TITLE_ATTRIBUTE + "=\"\"" +
" " + PREFS_ATTRIBUTE + "=\"\"" +
" " + STATE_ATTRIBUTE + "=\"\"" +
" " + AUTHOR_ATTRIBUTE + "=\"johnny_addgadget@rentacoder.com\">" +
"</" + TAGNAME + ">";
assertEquals(expectedValue, xml);
String[] categories = {"chess", "game"};
builder = GadgetXmlUtil.constructXml(xmlSource, "my pref", categories, LOGIN_NAME);
xml = builder.toString();
expectedValue = "<" + TAGNAME +
" " + URL_ATTRIBUTE + "=\"" + xmlSource + "\"" +
" " + TITLE_ATTRIBUTE + "=\"\"" +
" " + PREFS_ATTRIBUTE + "=\"my pref\"" +
" " + STATE_ATTRIBUTE + "=\"\"" +