From 98b3c1678fbc7cfe3985409030cdb7f62fac10a7 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 ff703cf6d..34e8bb43b 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 @@ -20,6 +20,7 @@ import static org.junit.Assert.*; import static org.mockito.Mockito.*; import java.util.Arrays; +import java.util.Date; import org.junit.Before; import org.junit.Test; @@ -29,7 +30,9 @@ import org.mockito.runners.MockitoJUnitRunner; import org.springframework.beans.BeansException; import org.springframework.beans.factory.ObjectFactory; import org.springframework.core.Ordered; +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; } }