> revisionIterator = revisions.iterator();
+
+ checkNextRevision(revisionIterator, "John", RevisionType.INSERT);
+ checkNextRevision(revisionIterator, "Jonny", RevisionType.UPDATE);
+ checkNextRevision(revisionIterator, null, RevisionType.DELETE);
+ assertThat(revisionIterator.hasNext()).isFalse();
+
+ }
+
+ /**
+ * Checks that the next element in the iterator is a Revision entry referencing a Person
+ * with the given name after whatever change brought that Revision into existence.
+ *
+ * As a side effect the Iterator gets advanced by one element.
+ *
+ * @param revisionIterator the iterator to be tested.
+ * @param name the expected name of the Person referenced by the Revision.
+ * @param revisionType the type of the revision denoting if it represents an insert, update or delete.
+ */
+ private void checkNextRevision(Iterator> revisionIterator, String name,
+ RevisionType revisionType) {
+
+ assertThat(revisionIterator.hasNext()).isTrue();
+ Revision revision = revisionIterator.next();
+ assertThat(revision.getEntity().name).isEqualTo(name);
+ assertThat(revision.getMetadata().getRevisionType()).isEqualTo(revisionType);
+ }
+
+ /**
+ * Creates a Person with a couple of changes so it has a non-trivial revision history.
+ * @return the created Person.
+ */
+ private Person preparePersonHistory() {
+
+ Person john = new Person();
+ john.setName("John");
+
+ // create
+ Person saved = tx.execute(__ -> repository.save(john));
+ assertThat(saved).isNotNull();
+
+ saved.setName("Jonny");
+
+ // update
+ Person updated = tx.execute(__ -> repository.save(saved));
+ assertThat(updated).isNotNull();
+
+ // delete
+ tx.executeWithoutResult(__ -> repository.delete(updated));
+ return updated;
+ }
+}
+----
+<1> This references the application context configuration presented above
+====
+
+[[envers.resources]]
+== Further Resources
+
+There is a https://github.com/spring-projects/spring-data-examples[Spring Data Envers example in the Spring Data Examples repository] that you can download and play around with to get a feel for how the library works.
+
+You should also check out the https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/repository/history/RevisionRepository.html[Javadoc for `RevisionRepository`] and related classes.
+
+Questions are best asked at https://stackoverflow.com/questions/tagged/spring-data-envers[Stackoverflow using the `spring-data-envers` tag].
+
+The https://github.com/spring-projects/spring-data-envers[source code and issue tracker for Spring Data Envers is hosted at GitHub].
+
+
diff --git a/src/main/asciidoc/index.adoc b/src/main/asciidoc/index.adoc
index 5daaab0c..a47a8025 100644
--- a/src/main/asciidoc/index.adoc
+++ b/src/main/asciidoc/index.adoc
@@ -1,9 +1,10 @@
= Spring Data Envers - Reference Documentation
-Oliver Gierke;
+Oliver Gierke; Jens Schauder
:revnumber: {version}
:revdate: {localdate}
+:javadoc-base: https://docs.spring.io/spring-data/envers/docs/{revnumber}/api/
:spring-data-commons-docs: ../../../../spring-data-commons/src/main/asciidoc
-
+:spring-data-commons-javadoc-base: https://docs.spring.io/spring-data/commons/docs/current/api/
(C) 2008-2021 The original authors.
NOTE: Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.
@@ -14,13 +15,13 @@ include::{spring-data-commons-docs}/dependencies.adoc[leveloffset=+1]
include::{spring-data-commons-docs}/repositories.adoc[leveloffset=+1]
[[reference]]
-= Reference Documentation
+== Reference Documentation
-== TODO
+include::envers.adoc[leveloffset=+1]
[[appendix]]
-= Appendix
+== Appendix
:numbered!:
include::{spring-data-commons-docs}/repository-namespace-reference.adoc[leveloffset=+1]