public void testCompareLSNs() { LogSequenceNumber lsn1 = new LogSequenceNumber(123, 456); LogSequenceNumber lsn2 = new LogSequenceNumber(123, 456); LogSequenceNumber lsn3 = new LogSequenceNumber(123, 789); LogSequenceNumber lsn4 = new LogSequenceNumber(125, 456); assert lsn1.compareTo(lsn2) == 0; assert lsn1.equals(lsn2); assert lsn1.hashCode() == lsn2.hashCode(); assert lsn1.compareTo(lsn3) < 0; assert lsn3.compareTo(lsn1) > 0; assert !lsn1.equals(lsn3); assert !lsn3.equals(lsn1); assert lsn1.compareTo(lsn4) < 0; assert lsn4.compareTo(lsn1) > 0; assert !lsn1.equals(lsn4); assert !lsn4.equals(lsn1); assert lsn3.compareTo(lsn4) < 0; assert lsn4.compareTo(lsn3) > 0; assert !lsn3.equals(lsn4); assert !lsn4.equals(lsn3); }
public void testCloneLSN() { LogSequenceNumber lsn1 = new LogSequenceNumber(123, 456); LogSequenceNumber lsn2 = lsn1.clone(); assert lsn1.equals(lsn2); assert lsn1.hashCode() == lsn2.hashCode(); assert lsn1.compareTo(lsn2) == 0; }