*/
public class XmlUtilsTest {
+ private static final String pathname = "test_xml_files/test_invalid";
+
/**
* Empty the XML directory after the test
*/
fail("XML test file does not exist");
}
assertFalse(XmlUtils.xmlValidate(testXmlFile).isOK());
+
+ }
+
+ /**
+ * Test various invalid files and make sure they are invalid
+ */
+ @Test
+ public void testXmlValidateInvalid() {
+ File[] validFiles = (new File(pathname)).listFiles();
+ for (File f : validFiles) {
+ assertFalse("File " + f.getName(), XmlUtils.xmlValidate(f).isOK());
+ }
}
+
/**
* test the {@link XmlUtils#addXmlFile(File)} method
*/
Element analysis = XmlUtils.getElementInFile(testXmlFile.getAbsolutePath(), TmfXmlStrings.STATE_PROVIDER, ANALYSIS_ID);
- List<Element> values = XmlUtils.getChildElements(analysis, TmfXmlStrings.DEFINED_VALUE);
- assertEquals(12, values.size());
+ List<Element> values = XmlUtils.getChildElements(analysis, TmfXmlStrings.LOCATION);
+ assertEquals(5, values.size());
+
+ Element aLocation = values.get(0);
+ List<Element> attributes = XmlUtils.getChildElements(aLocation, TmfXmlStrings.STATE_ATTRIBUTE);
+ assertEquals(2, attributes.size());
values = XmlUtils.getChildElements(analysis, TmfXmlStrings.HEAD);
assertEquals(1, values.size());