VClock { public void printVC() { System.out.println(returnVCString()); } 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 printVC() throws Exception { ByteArrayOutputStream outContent = new ByteArrayOutputStream(); System.setOut(new PrintStream(outContent)); testClock.set("Proc1", 2); testClock.set("Proc3", 3); testClock.set("Proc2", 7); testClock.printVC(); assertEquals("{\"Proc1\":2, \"Proc2\":7," + " \"Proc3\":3}\n", outContent.toString()); System.setOut(null); }