Polishing.

Add `@author` tags to changed files.
Remove Hamcrest usage.

Original pull request #602
Related tickest #583
This commit is contained in:
Jens Schauder
2021-01-29 10:10:58 +01:00
parent 6a894d9334
commit 64c1eeaf05
29 changed files with 150 additions and 100 deletions

View File

@@ -15,10 +15,6 @@
*/
package example.springdata.jpa.multipleds.customer;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Optional;
import javax.persistence.EntityManager;
@@ -31,10 +27,14 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.transaction.annotation.Transactional;
import static org.assertj.core.api.Assertions.*;
/**
* Integration test for {@link CustomerRepository}.
*
* @author Oliver Gierke
* @author Divya Srivastava
* @author Jens Schauder
*/
@ExtendWith(SpringExtension.class)
@SpringBootTest
@@ -49,7 +49,7 @@ public class CustomerRepositoryTests {
Optional<Customer> result = repository.findByLastname("Matthews");
assertThat(result, is(not(Optional.empty())));
assertThat(result.get().getFirstname(), is("Dave"));
assertThat(result).isNotEmpty();
assertThat(result.get().getFirstname()).isEqualTo("Dave");
}
}

View File

@@ -15,8 +15,9 @@
*/
package example.springdata.jpa.multipleds.order;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.assertj.core.api.Assertions.*;
import example.springdata.jpa.multipleds.customer.CustomerRepository;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -25,12 +26,12 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.transaction.annotation.Transactional;
import example.springdata.jpa.multipleds.customer.CustomerRepository;
/**
* Integration test for {@link CustomerRepository}.
*
* @author Oliver Gierke
* @author Divya Srivastava
* @author Jens Schauder
*/
@ExtendWith(SpringExtension.class)
@SpringBootTest
@@ -44,7 +45,7 @@ public class OrderRepositoryTests {
public void persistsAndFindsCustomer() {
customers.findAll().forEach(customer -> {
assertThat(orders.findByCustomer(customer.getId()), hasSize(1));
assertThat(orders.findByCustomer(customer.getId())).hasSize(1);
});
}
}