### Question:
NodeDiff implements GraphDiff, Comparable<NodeDiff> { @Override public int compareTo(NodeDiff o) { return diffId - o.getDiffId(); } NodeDiff(Object nodeId);  NodeDiff(Object nodeId, int diffId); @Override boolean isNoop(); @Override abstract void apply(GraphChangeHandler tracker); @Override abstract void undo(GraphChangeHandler tracker); Object getNodeId(); int getDiffId(); void setDiffId(int diffId); @Override int compareTo(NodeDiff o);  }### Answer:
@Test public void testCompareTo() { NodeDiff d1 = new ConcreteNodeDiff("x", 1); NodeDiff d2 = new ConcreteNodeDiff("y", 2); NodeDiff d3 = new ConcreteNodeDiff("z", 3); NodeDiff d4 = new ConcreteNodeDiff("a", 2); assertTrue(d1.compareTo(d2) < 0); assertTrue(d2.compareTo(d1) > 0); assertTrue(d1.compareTo(d3) < 0); assertTrue(d2.compareTo(d4) == 0); assertTrue(d2.compareTo(d3) < 0); }