Value extends Expirable { @Override @SuppressWarnings("unchecked") public boolean isReplaceableBy(long txTimestamp, Object newVersion, Comparator versionComparator) { return version == null ? timestamp <= txTimestamp : versionComparator.compare(version, newVersion) < 0; } Value();  Value(Object version, long timestamp, Object value); @Override @SuppressWarnings("unchecked") boolean isReplaceableBy(long txTimestamp, Object newVersion, Comparator versionComparator); long getTimestamp(); @Override Object getValue(); @Override Object getValue(long txTimestamp); @Override boolean matches(ExpiryMarker lock); @Override ExpiryMarker markForExpiration(long timeout, String nextMarkerId); @Override void readData(ObjectDataInput in); @Override void writeData(ObjectDataOutput out); @Override int getFactoryId(); @Override int getId();  }
@Test public void testIsReplaceableByTimestampBefore() throws Exception { String expectedValue = "Some value"; Value value = new Value(null, 100L, expectedValue); assertFalse(value.isReplaceableBy(99L, null, null)); }
@Test public void testIsReplaceableByTimestampEqual() throws Exception { String expectedValue = "Some value"; Value value = new Value(null, 100L, expectedValue); assertTrue(value.isReplaceableBy(100L, null, null)); }
@Test public void testIsReplaceableByTimestampAfter() throws Exception { String expectedValue = "Some value"; Value value = new Value(null, 100L, expectedValue); assertTrue(value.isReplaceableBy(101L, null, null)); }
@Test public void testIsReplaceableByVersionBefore() throws Exception { String expectedValue = "Some value"; Value value = new Value(10, 100L, expectedValue); assertFalse(value.isReplaceableBy(99L, 9, ComparableComparator.INSTANCE)); }
@Test public void testIsReplaceableByVersionEqual() throws Exception { String expectedValue = "Some value"; Value value = new Value(10, 100L, expectedValue); assertFalse(value.isReplaceableBy(101L, 10, ComparableComparator.INSTANCE)); }
@Test public void testIsReplaceableByVersionAfter() throws Exception { String expectedValue = "Some value"; Value value = new Value(10, 100L, expectedValue); assertTrue(value.isReplaceableBy(99L, 11, ComparableComparator.INSTANCE)); }