From f66d773a94aa757743f249f98263b5bde602bb41 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Mon, 18 Nov 2013 13:50:42 +0100 Subject: [PATCH] DATAMONGO-800 - Improved AuditingIntegrationTests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a tiny Thread.sleep(…) to make sure the assertion works on fast machines. If the operations after the first step all happen within a millisecond, it will fail. --- .../data/mongodb/config/AuditingIntegrationTests.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/AuditingIntegrationTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/AuditingIntegrationTests.java index 108c73b53..c4fe124ae 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/AuditingIntegrationTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/AuditingIntegrationTests.java @@ -35,7 +35,7 @@ import org.springframework.data.mongodb.core.mapping.event.BeforeConvertEvent; public class AuditingIntegrationTests { @Test - public void enablesAuditingAndSetsPropertiesAccordingly() { + public void enablesAuditingAndSetsPropertiesAccordingly() throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext("auditing.xml", getClass()); @@ -46,6 +46,7 @@ public class AuditingIntegrationTests { assertThat(entity.created, is(notNullValue())); assertThat(entity.modified, is(entity.created)); + Thread.sleep(10); entity.id = 1L; event = new BeforeConvertEvent(entity); context.publishEvent(event);