Use AssertJ in spring-boot-samples
See gh-5083
This commit is contained in:
@@ -26,9 +26,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.greaterThan;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link CityRepository}.
|
||||
@@ -46,6 +44,6 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,10 +33,7 @@ import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link HotelRepository}.
|
||||
@@ -57,17 +54,17 @@ public class HotelRepositoryIntegrationTests {
|
||||
City city = this.cityRepository
|
||||
.findAll(new PageRequest(0, 1, Direction.ASC, "name")).getContent()
|
||||
.get(0);
|
||||
assertThat(city.getName(), is("Atlanta"));
|
||||
assertThat(city.getName()).isEqualTo("Atlanta");
|
||||
|
||||
Page<HotelSummary> hotels = this.repository.findByCity(city,
|
||||
new PageRequest(0, 10, Direction.ASC, "name"));
|
||||
Hotel hotel = this.repository.findByCityAndName(city,
|
||||
hotels.getContent().get(0).getName());
|
||||
assertThat(hotel.getName(), is("Doubletree"));
|
||||
assertThat(hotel.getName()).isEqualTo("Doubletree");
|
||||
|
||||
List<RatingCount> counts = this.repository.findRatingCounts(hotel);
|
||||
assertThat(counts, hasSize(1));
|
||||
assertThat(counts.get(0).getRating(), is(Rating.AVERAGE));
|
||||
assertThat(counts.get(0).getCount(), is(greaterThan(1L)));
|
||||
assertThat(counts).hasSize(1);
|
||||
assertThat(counts.get(0).getRating()).isEqualTo(Rating.AVERAGE);
|
||||
assertThat(counts.get(0).getCount()).isGreaterThan(1L);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user