Consider annotated methods in AnnotationRevisionMetadata.
We now detect annotated methods. Closes #2569
This commit is contained in:
committed by
Jens Schauder
parent
8e241b1938
commit
6bc28c118c
@@ -33,6 +33,7 @@ import org.springframework.data.annotation.Reference;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Jens Schauder
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
class AnnotationRevisionMetadataUnitTests {
|
||||
|
||||
@@ -83,6 +84,21 @@ class AnnotationRevisionMetadataUnitTests {
|
||||
softly.assertAll();
|
||||
}
|
||||
|
||||
@Test // GH-2569
|
||||
void exposesRevisionMetadataUsingMethodAccessors() {
|
||||
|
||||
SampleWithMethodAnnotations sample = new SampleWithMethodAnnotations();
|
||||
sample.revisionNumber = 1L;
|
||||
sample.revisionDate = Instant.now();
|
||||
|
||||
RevisionMetadata<Long> metadata = getMetadata(sample);
|
||||
|
||||
softly.assertThat(metadata.getRevisionNumber()).hasValue(1L);
|
||||
softly.assertThat(metadata.getRevisionInstant()).hasValue(sample.revisionDate);
|
||||
|
||||
softly.assertAll();
|
||||
}
|
||||
|
||||
@Test // DATACMNS-1251
|
||||
void exposesRevisionDateAndInstantForInstant() {
|
||||
|
||||
@@ -149,6 +165,22 @@ class AnnotationRevisionMetadataUnitTests {
|
||||
@Reference LocalDateTime revisionDate;
|
||||
}
|
||||
|
||||
static class SampleWithMethodAnnotations {
|
||||
|
||||
Long revisionNumber;
|
||||
Instant revisionDate;
|
||||
|
||||
@Autowired
|
||||
public Long getRevisionNumber() {
|
||||
return revisionNumber;
|
||||
}
|
||||
|
||||
@Reference
|
||||
public Instant getRevisionDate() {
|
||||
return revisionDate;
|
||||
}
|
||||
}
|
||||
|
||||
static class SampleWithInstant {
|
||||
|
||||
@Autowired Long revisionNumber;
|
||||
|
||||
Reference in New Issue
Block a user