VClock { public String returnVCString() { int mapSize = this.vc.size(); int i = 0; StringBuilder vcString = new StringBuilder(); vcString.append("{"); for (Map.Entry<String, Long> clock : this.vc.entrySet()) { vcString.append("\""); vcString.append(clock.getKey()); vcString.append("\":"); vcString.append(clock.getValue()); if (i < mapSize - 1) vcString.append(", "); i++; } vcString.append("}"); return vcString.toString(); } VClock(); void tick(String pid); void set(String pid, long ticks); VClock copy(); long findTicks(String pid); long lastUpdate(); void merge(VClock other); String returnVCString(); void printVC(); TreeMap<String, Long> getClockMap();  }
@Test public void returnVCString() throws Exception { testClock.set("Proc1", 1); testClock.set("Proc2", 2); testClock.set("Proc5", 6); testClock.set("", 0); assertEquals("The function does not return the correct String!", "{\"\":1, \"Proc1\":1, \"Proc2\":2," + " \"Proc5\":6}", testClock.returnVCString()); }