Browse Source

DATAMONGO-800 - Improved AuditingIntegrationTests.

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.
pull/125/merge
Oliver Gierke 12 years ago
parent
commit
f66d773a94
  1. 3
      spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/AuditingIntegrationTests.java

3
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; @@ -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 { @@ -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>(entity);
context.publishEvent(event);

Loading…
Cancel
Save