public void testManagerCanInsertAnElementIntoFile() throws Exception {
  Document document=builder.newDocument();
  Element application=document.createElement("Application");
  document.appendChild(application);
  util.saveXml(document,TEST_FILE);
  fileHandler.createFile(TEST_FILE);
  manager.setFile(TEST_FILE);
  manager.loadFile();
  manager.insertElementsUnderXPath("<subnode property='hello' />","//Application");
  manager.writeFile();
  String xml=fileHandler.readTextFile(TEST_FILE,"UTF-8");
  XMLAssert.assertXpathEvaluatesTo("hello","//Application/subnode/@property",xml);
}

public void testManagerCanInsertAnElementIntoFile ( ) throws Exception { Document document = builder . newDocument ( ) ; Element application = document . createElement ( "Application" ) ; document . appendChild ( application ) ; util . saveXml ( document , TEST_FILE ) ; fileHandler . createFile ( TEST_FILE ) ; manager . setFile ( TEST_FILE ) ; manager . loadFile ( ) ; manager . insertElementsUnderXPath ( "<subnode property='hello' />" , "//Application" ) ; manager . writeFile ( ) ; String xml = fileHandler . readTextFile ( TEST_FILE , "UTF-8" ) ; XMLAssert . assertXpathEvaluatesTo ( "hello" , "//Application/subnode/@property" , xml ) ; }
test that the file system manager can insert an xml element into a file .
