@Test
public void testWriteReadXML2() {
    String xmlfile = "src\\testfiles\\testWriteRead2.xml";
    
    //create a valid stock symbol and insert test data. 
    String symbol = "testsymbol";
    Map<String,String> obj = persistence.createSymbol(symbol);
    obj.put("somefield", "somedata");
    persistence.saveSymbol(symbol);
    
    String symbol2 = "testsymbol2";
    Map<String,String> obj2 = persistence.createSymbol(symbol2);
    obj2.put("somefield", "somedata2");
    persistence.saveSymbol(symbol2);
    

    persistence.writeDB(xmlfile);
    
    //Now read the data back in
    
    PersistSymbolXML newdb = new PersistSymbolXML();
    newdb.readFromDB(xmlfile);
    
    Set<String> allsymbols = newdb.getSymbols();
    assertTrue(allsymbols.contains(symbol));
    assertTrue(allsymbols.contains(symbol2));
    assertTrue(allsymbols.size() == 2);
    
    //add a new Stock Symbol
    String symbol3 = "testsymbol3";
    Map<String,String> obj3 = newdb.createSymbol(symbol3);
    obj3.put("somefiled","somedata3");
    newdb.saveSymbol(symbol3);
    newdb.writeDB(); //Test the overloaded method which writes to the same XML file it read from
    assertTrue(newdb.getSymbols().size()==3);// Now we should have one more stock symbol
    
    
    
}