Use AssertJ in spring-boot-samples
See gh-5083
This commit is contained in:
@@ -27,11 +27,7 @@ import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link CityRepository}.
|
||||
@@ -50,15 +46,15 @@ public class CityRepositoryIntegrationTests {
|
||||
public void findsFirstPageOfCities() {
|
||||
|
||||
Page<City> cities = this.repository.findAll(new PageRequest(0, 10));
|
||||
assertThat(cities.getTotalElements(), is(greaterThan(20L)));
|
||||
assertThat(cities.getTotalElements()).isGreaterThan(20L);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findByNameAndCountry() {
|
||||
City city = this.repository.findByNameAndCountryAllIgnoringCase("Melbourne",
|
||||
"Australia");
|
||||
assertThat(city, notNullValue());
|
||||
assertThat(city.getName(), is(equalTo("Melbourne")));
|
||||
assertThat(city).isNotNull();
|
||||
assertThat(city.getName()).isEqualTo("Melbourne");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -66,6 +62,6 @@ public class CityRepositoryIntegrationTests {
|
||||
Page<City> cities = this.repository
|
||||
.findByNameContainingAndCountryContainingAllIgnoringCase("", "UK",
|
||||
new PageRequest(0, 10));
|
||||
assertThat(cities.getTotalElements(), is(equalTo(3L)));
|
||||
assertThat(cities.getTotalElements()).isEqualTo(3L);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user