Record { public void append(Revision<L, K, V> revision) { write.lock(); try { Preconditions.checkArgument( (this instanceof TableRecord && revision.getVersion() >= version) || true, "Cannot " + "append %s because its version(%s) is lower " + "than the Record's current version(%s). The", revision, revision.getVersion(), version); Preconditions.checkArgument(revision.getLocator().equals(locator), "Cannot append %s because it does not belong to %s", revision, this); Preconditions.checkArgument( (partial && revision.getKey().equals(key)) || !partial || this instanceof CorpusRecord, "Cannot append %s because it does not belong to %s", revision, this); Preconditions.checkArgument( this instanceof CorpusRecord || isOffset(revision), "Cannot append " + "%s because it represents an action " + "involving a key, value and locator that has not " + "been offset.", revision); Set<V> values = present.get(revision.getKey()); if(values == null) { values = Sets.<V> newLinkedHashSet(); present.put(revision.getKey(), values); } if(revision.getType() == Action.ADD) { values.add(revision.getValue()); } else { values.remove(revision.getValue()); if(values.isEmpty()) { present.remove(revision.getKey()); } } List<CompactRevision<V>> revisions = history.get(revision.getKey()); if(revisions == null) { revisions = Lists.newArrayList(); history.put(revision.getKey(), revisions); } revisions.add(revision.compact()); version = Math.max(version, revision.getVersion()); onAppend(revision); revision = null; } finally { write.unlock(); } } protected  Record(L locator, @Nullable K key); void append(Revision<L, K, V> revision); int cardinality(); @Override boolean equals(Object obj); long getVersion(); @Override int hashCode(); boolean isEmpty(); boolean isPartial(); @Override String toString();  }
@Test(expected = IllegalArgumentException.class) public void testCannotAppendSmallerVersion() { record = getRecord(); Revision<L, K, V> r1 = getRevision(); Revision<L, K, V> r2 = getRevision(); record.append(r2); record.append(r1); }