@Test
public void testHTML() throws Exception {

    Formatter formatter;
    String resultString;
    LoadRecord rec1, rec2;
    String expected;
    Map<Level, LoadRecord> loadMap;
    LoadRecord summary;
    Load load = new Load(new LevelClass(ServerName.class));
    // iteration 1
    loadMap = new TreeMap<>();
    rec1 = new LoadRecord();
    rec1.put(LoadEntry.MemstoreSize, 1);
    rec1.put(LoadEntry.Writes, 1);
    loadMap.put(new Level("rec1"), rec1);
    rec2 = new LoadRecord();
    rec2.put(LoadEntry.Writes, 2);
    loadMap.put(new Level("rec2"), rec2);
    summary = new LoadRecord();
    summary.put(LoadEntry.MemstoreSize, 1);
    summary.put(LoadEntry.Writes, 3);
    load.setLoadMap(loadMap);
    load.setSummary(summary);
    load.updateChangeMap();
    formatter = new Formatter("testTable", load);
    resultString = formatter.buildString(false, Formatter.Type.HTML);
    System.out.println(resultString);
    expected = "<span style=\"color:green\">RegionServer</span>  <span style=\"color:cyan\">Reads</span>      <span style=\"color:cyan\">Writes</span>   <span style=\"color:cyan\">Regions</span>    <span style=\"color:cyan\">Files</span>      <span style=\"color:cyan\">FileSize</span>   <span style=\"color:cyan\">FileSizeUncomp</span>  <span style=\"color:cyan\">MemstoreSize</span>  <span style=\"color:cyan\">CompactedKVs</span>  \n" +
            "<b> rec1</b>         N/A | N/A  1 | N/A  N/A | N/A  N/A | N/A  N/A | N/A  N/A | N/A        1m | N/A     N/A | N/A     \n" +
            "<b> rec2</b>         N/A | N/A  2 | N/A  N/A | N/A  N/A | N/A  N/A | N/A  N/A | N/A       N/A | N/A     N/A | N/A     \n" +
            "<b> Total: 2</b>     N/A | N/A  3 | N/A  N/A | N/A  N/A | N/A  N/A | N/A  N/A | N/A        1m | N/A     N/A | N/A     \n";
    Assert.assertEquals(expected, resultString);
    // iteration 2
    load.prepare();
    loadMap = new TreeMap<>();
    rec1 = new LoadRecord();
    rec1.put(LoadEntry.MemstoreSize, 1);
    rec1.put(LoadEntry.Writes, 2);
    loadMap.put(new Level("rec1"), rec1);
    rec2 = new LoadRecord();
    rec2.put(LoadEntry.Writes, 2);
    loadMap.put(new Level("rec2"), rec2);
    summary = new LoadRecord();
    summary.put(LoadEntry.MemstoreSize, 1);
    summary.put(LoadEntry.Writes, 4);
    load.setLoadMap(loadMap);
    load.setSummary(summary);
    load.updateChangeMap();
    resultString = formatter.buildString(false, Formatter.Type.HTML);
    System.out.println(resultString);
    expected = "<span style=\"color:green\">RegionServer</span>  <span style=\"color:cyan\">Reads</span>      <span style=\"color:cyan\">Writes</span>  <span style=\"color:cyan\">Regions</span>    <span style=\"color:cyan\">Files</span>      <span style=\"color:cyan\">FileSize</span>   <span style=\"color:cyan\">FileSizeUncomp</span>  <span style=\"color:cyan\">MemstoreSize</span>  <span style=\"color:cyan\">CompactedKVs</span>  \n" +
            "<b> rec1</b>         N/A | N/A  <span style=\"color:yellow\">2</span> | <span style=\"color:yellow\">1</span>   N/A | N/A  N/A | N/A  N/A | N/A  N/A | N/A        1m |  0m     N/A | N/A     \n" +
            "<b> rec2</b>         N/A | N/A  2 | 0   N/A | N/A  N/A | N/A  N/A | N/A  N/A | N/A       N/A | N/A     N/A | N/A     \n" +
            "<b> Total: 2</b>     N/A | N/A  <span style=\"color:yellow\">4</span> | <span style=\"color:yellow\">1</span>   N/A | N/A  N/A | N/A  N/A | N/A  N/A | N/A        1m |  0m     N/A | N/A     \n";
    Assert.assertEquals(expected, resultString);
}