Search in sources :

Example 1 with City

use of sample.data.rest.domain.City in project spring-boot by spring-projects.

the class CityRepositoryIntegrationTests method findContaining.

@Test
public void findContaining() {
    Page<City> cities = this.repository.findByNameContainingAndCountryContainingAllIgnoringCase("", "UK", new PageRequest(0, 10));
    assertThat(cities.getTotalElements()).isEqualTo(3L);
}
Also used : PageRequest(org.springframework.data.domain.PageRequest) City(sample.data.rest.domain.City) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 2 with City

use of sample.data.rest.domain.City in project spring-boot by spring-projects.

the class CityRepositoryIntegrationTests method findsFirstPageOfCities.

@Test
public void findsFirstPageOfCities() {
    Page<City> cities = this.repository.findAll(new PageRequest(0, 10));
    assertThat(cities.getTotalElements()).isGreaterThan(20L);
}
Also used : PageRequest(org.springframework.data.domain.PageRequest) City(sample.data.rest.domain.City) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 3 with City

use of sample.data.rest.domain.City in project spring-boot by spring-projects.

the class CityRepositoryIntegrationTests method findByNameAndCountry.

@Test
public void findByNameAndCountry() {
    City city = this.repository.findByNameAndCountryAllIgnoringCase("Melbourne", "Australia");
    assertThat(city).isNotNull();
    assertThat(city.getName()).isEqualTo("Melbourne");
}
Also used : City(sample.data.rest.domain.City) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 City (sample.data.rest.domain.City)3 PageRequest (org.springframework.data.domain.PageRequest)2