Polishing.
Add `@author` tags to changed files. Remove Hamcrest usage. Original pull request #602 Related tickest #583
This commit is contained in:
@@ -15,10 +15,6 @@
|
||||
*/
|
||||
package example.springdata.jpa.auditing;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.notNullValue;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -28,9 +24,13 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
* @author Thomas Darimont
|
||||
* @author Divya Srivastava
|
||||
* @author Jens Schauder
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@Transactional
|
||||
@@ -44,7 +44,7 @@ public class AuditableUserSample {
|
||||
@Test
|
||||
public void auditEntityCreation() throws Exception {
|
||||
|
||||
assertThat(ReflectionTestUtils.getField(listener, "handler"),is(notNullValue()));
|
||||
assertThat(ReflectionTestUtils.getField(listener, "handler")).isNotNull();
|
||||
|
||||
AuditableUser user = new AuditableUser();
|
||||
user.setUsername("username");
|
||||
@@ -54,7 +54,7 @@ public class AuditableUserSample {
|
||||
user = repository.save(user);
|
||||
user = repository.save(user);
|
||||
|
||||
assertThat(user.getCreatedBy(), is(user));
|
||||
assertThat(user.getLastModifiedBy(), is(user));
|
||||
assertThat(user.getCreatedBy()).isEqualTo(user);
|
||||
assertThat(user.getLastModifiedBy()).isEqualTo(user);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.springframework.data.jpa.repository.support.JpaRepositoryFactory;
|
||||
* Test case showing how to use the basic {@link GenericDaoFactory}
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Divya Srivastava
|
||||
*/
|
||||
public class BasicFactorySetup {
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.springframework.data.repository.CrudRepository;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Thomas Darimont
|
||||
* @author Divya Srivastava
|
||||
*/
|
||||
public class BasicSample {
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @author Oliver Gierke
|
||||
* @author Thomas Darimont
|
||||
* @author Andrea Rizzini
|
||||
* @author Divya Srivastava
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@Transactional
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* Integration test showing the usage of a composite repository via {@link UserRepository}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Divya Srivastava
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@Transactional
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Thomas Darimont
|
||||
* @author Divya Srivastava
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@Transactional
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* Intergration test showing the usage of a custom method implemented for all repositories
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Divya Srivastava
|
||||
* @soundtrack Elen - It's you (Elen)
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* Integration tests for {@link CustomerRepository} to show projection capabilities.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Divya Srivastava
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest
|
||||
|
||||
@@ -16,10 +16,6 @@
|
||||
package example.springdata.jpa.simple;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.hamcrest.Matchers.hasItems;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.iterableWithSize;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.springframework.data.domain.Sort.Direction.ASC;
|
||||
import static org.springframework.data.domain.Sort.Direction.DESC;
|
||||
|
||||
@@ -45,6 +41,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @author Oliver Gierke
|
||||
* @author Thomas Darimont
|
||||
* @author Christoph Strobl
|
||||
* @author Divya Srivastava
|
||||
* @author Jens Schauder
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@Transactional
|
||||
@@ -155,8 +153,7 @@ public class SimpleUserRepositoryTests {
|
||||
|
||||
List<User> result = repository.findFirst2ByOrderByLastnameAsc();
|
||||
|
||||
assertThat(result.size(), is(2));
|
||||
assertThat(result, hasItems(user0, user1));
|
||||
assertThat(result).containsExactly(user0, user1);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -176,13 +173,11 @@ public class SimpleUserRepositoryTests {
|
||||
|
||||
List<User> resultAsc = repository.findTop2By(Sort.by(ASC, "lastname"));
|
||||
|
||||
assertThat(resultAsc.size(), is(2));
|
||||
assertThat(resultAsc, hasItems(user0, user1));
|
||||
assertThat(resultAsc).containsExactly(user0, user1);
|
||||
|
||||
List<User> resultDesc = repository.findTop2By(Sort.by(DESC, "lastname"));
|
||||
|
||||
assertThat(resultDesc.size(), is(2));
|
||||
assertThat(resultDesc, hasItems(user1, user2));
|
||||
assertThat(resultDesc).containsExactly(user2, user1);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -204,7 +199,6 @@ public class SimpleUserRepositoryTests {
|
||||
|
||||
Iterable<User> users = repository.findByFirstnameOrLastname(reference);
|
||||
|
||||
assertThat(users, is(iterableWithSize(2)));
|
||||
assertThat(users, hasItems(first, second));
|
||||
assertThat(users).containsExactly(first, second);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user