VClock { public long findTicks(String pid) { if (!this.vc.containsKey(pid)) { return -1; } return this.vc.get(pid); } 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 findTicks() throws Exception { testClock.tick("Proc1"); testClock.set("Proc2", 50); long tickResult = testClock.findTicks("Proc1"); long setResult = testClock.findTicks("Proc2"); assertEquals("Key value for tick Proc1 does not match the expected value!", 1L, tickResult); assertEquals("Key value for set Proc1 does not match the expected value!", 50L, setResult); long emptyResult = testClock.findTicks("Proc3"); assertEquals("Key value for set Proc3 should not be found!", -1, emptyResult); }
@Test(expected = NullPointerException.class) public void findTicksNullPointerException() { testClock.findTicks(null); }