DATAJPA-303 - Added integration test to show auditing on update working.

This commit is contained in:
Oliver Gierke
2013-03-19 17:44:39 +01:00
parent 08831c1f60
commit 9dcf919207

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2011 the original author or authors.
* Copyright 2008-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,18 +57,32 @@ public class AuditingEntityListenerTests {
user = new AuditableUser();
auditorAware.setAuditor(user);
repository.save(user);
repository.saveAndFlush(user);
}
@Test
public void auditsRootEntityCorrectly() throws Exception {
public void auditsRootEntityCorrectly() {
assertDatesSet(user);
assertUserIsAuditor(user, user);
}
/**
* @see DATAJPA-303
*/
@Test
public void auditsTransitiveEntitiesCorrectly() throws Exception {
public void updatesLastModifiedDates() throws Exception {
Thread.sleep(200);
user.setFirstname("Oliver");
user = repository.saveAndFlush(user);
assertThat(user.getCreatedDate().isBefore(user.getLastModifiedDate()), is(true));
}
@Test
public void auditsTransitiveEntitiesCorrectly() {
AuditableRole role = new AuditableRole();
role.setName("ADMIN");