From 7c61134b675df519f5025fbc7d8f5f825f4eedcd Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Fri, 20 Jan 2017 16:33:59 +0100 Subject: [PATCH] DATAMONGO-1592 - Adapt AuditingEventListenerUnitTests to changes in core auditing. The core auditing implementation now skips the invocation of auditing in case the candidate aggregate doesn't need any auditing in the first place. We needed to adapt the sample class we use to actually carry the necessary auditing annotations. Related ticket: DATACMNS-957. --- .../core/mapping/event/AuditingEventListenerUnitTests.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/AuditingEventListenerUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/AuditingEventListenerUnitTests.java index 9387a2449..e2dbce9f0 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/AuditingEventListenerUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/AuditingEventListenerUnitTests.java @@ -19,6 +19,7 @@ import static org.mockito.Matchers.*; import static org.mockito.Mockito.*; import java.util.Arrays; +import java.util.Date; import org.junit.Before; import org.junit.Test; @@ -27,7 +28,9 @@ import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; import org.springframework.beans.BeansException; import org.springframework.beans.factory.ObjectFactory; +import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.Id; +import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.auditing.IsNewAwareAuditingHandler; import org.springframework.data.mapping.context.PersistentEntities; import org.springframework.data.mongodb.core.mapping.MongoMappingContext; @@ -101,5 +104,7 @@ public class AuditingEventListenerUnitTests { static class Sample { @Id String id; + @CreatedDate Date created; + @LastModifiedDate Date modified; } }