GrowOnlyCounter implements CrdtCounter<Long, GrowOnlyCounter> { @Override public GrowOnlyCounter merge(GrowOnlyCounter other) { return new GrowOnlyCounter(this, other); } GrowOnlyCounter(Map<String, Long> counters);  GrowOnlyCounter(GrowOnlyCounter growOnlyCounter, Builder builder);  GrowOnlyCounter(Builder builder);  GrowOnlyCounter(GossipManager manager);  GrowOnlyCounter(GrowOnlyCounter growOnlyCounter, GrowOnlyCounter other); @Override GrowOnlyCounter merge(GrowOnlyCounter other); @Override Long value(); @Override GrowOnlyCounter optimize(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void mergeTest() { Map<String, Long> node1Counter = new HashMap<>(); node1Counter.put("1", 3L); Map<String, Long> node2Counter = new HashMap<>(); node2Counter.put("2", 1L); Map<String, Long> node3Counter = new HashMap<>(); node3Counter.put("3", 2L); GrowOnlyCounter gCounter1 = new GrowOnlyCounter(node1Counter); GrowOnlyCounter gCounter2 = new GrowOnlyCounter(node2Counter); GrowOnlyCounter gCounter3 = new GrowOnlyCounter(node3Counter); gCounter2 = gCounter2.merge(gCounter1); Assert.assertEquals(4, (long) gCounter2.value()); gCounter3 = gCounter3.merge(gCounter1); Assert.assertEquals(5, (long) gCounter3.value()); gCounter3 = gCounter3.merge(gCounter2); Assert.assertEquals(6, (long) gCounter3.value()); }