/**
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, version 2.1, dated February 1999.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the latest version of the GNU Lesser General
* Public License as published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program (LICENSE.txt); if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Based on code generated by Agitar build: Agitator Version 1.0.2.000071 (Build date: Jan 12, 2007) [1.0.2.000071]
*/
package org.jamwiki.utils;
import java.io.File;
import java.sql.Timestamp;
import junit.framework.TestCase;
/**
*
*/
public class XMLUtilTest extends TestCase {
/**
*
*/
public void testBuildTag() throws Throwable {
String result = XMLUtil.buildTag("testXMLUtilTagName", 100L);
assertEquals("result", "<testXMLUtilTagName>100</testXMLUtilTagName>", result);
}
/**
*
*/
public void testBuildTag1() throws Throwable {
String result = XMLUtil.buildTag("testXMLUtilTagName", true);
assertEquals("result", "<testXMLUtilTagName>true</testXMLUtilTagName>", result);
}
/**
*
*/
public void testBuildTag2() throws Throwable {
String result = XMLUtil.buildTag("testXMLUtilTagName", new Integer(0));
assertEquals("result", "<testXMLUtilTagName>0</testXMLUtilTagName>", result);
}
/**
*
*/
public void testBuildTag3() throws Throwable {
String result = XMLUtil.buildTag("testXMLUtilTagName", new Timestamp(0));
// FIXME
// assertEquals("result", "<testXMLUtilTagName>1970-01-01 00:00:00.1</testXMLUtilTagName>", result);
}
/**
*
*/
public void testBuildTag4() throws Throwable {
String result = XMLUtil.buildTag("testXMLUtilTagName", (Timestamp) null);
assertEquals("result", "", result);
}
/**
*
*/
public void testBuildTag5() throws Throwable {
String result = XMLUtil.buildTag("testXMLUtilTagName", 100);
assertEquals("result", "<testXMLUtilTagName>100</testXMLUtilTagName>", result);
}
/**
*
*/
public void testBuildTag6() throws Throwable {
String result = XMLUtil.buildTag("testXMLUtilTagName", "testXMLUtilTagValue", true);
assertEquals("result", "<testXMLUtilTagName>testXMLUtilTagValue</testXMLUtilTagName>", result);
}
/**
*
*/
public void testBuildTag7() throws Throwable {
String result = XMLUtil.buildTag("testXMLUtilTagName", "testXMLUtilTagValue", false);
assertEquals("result", "<testXMLUtilTagName>testXMLUtilTagValue</testXMLUtilTagName>", result);
}
/**
*
*/
public void testBuildTag8() throws Throwable {
String result = XMLUtil.buildTag("testXMLUtilTagName", null, true);
assertEquals("result", "", result);
}
/**
*
*/
public void testGetTextContent() throws Throwable {
// FIXME - implement this
}
/**
*
*/
public void testGetTextContentThrowsNullPointerException() throws Throwable {
try {
XMLUtil.getTextContent(null);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
}
}
/**
*
*/
public void testParseXMLThrowsNullPointerException() throws Throwable {
try {
XMLUtil.parseXML((File) null, true);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
assertNotNull("XMLUtil.logger", XMLUtil.logger);
}
}
}
|