VectorClock extends TreeMap<String, Long> { @Override public VectorClock clone() { return (VectorClock) super.clone(); }  Long incrementClock(String unit); void setClock(String unit, long value); Long getClock(String unit); @Override Long get(Object unit); @Override VectorClock clone(); @Override String toString(); static VectorClock parseVectorClock(String serializedVectorClock); static VectorClockComparison compare(VectorClock clock1, VectorClock clock2); static final Pattern MACHINE_PATTERN; }
@Test public void testClone() { VectorClock vc1 = new VectorClock(); vc1.setClock("UnitA", 4L); vc1.setClock("UnitB", 5L); VectorClock vc2 = vc1.clone(); assertEquals("Expected clock value of cloned clock to be different.", 4L, (long) vc2.getClock("UnitA")); assertEquals("Expected clock value of cloned clock to be different.", 5L, (long) vc2.getClock("UnitB")); }