Use AssertJ in spring-boot-samples

See gh-5083
This commit is contained in:
Phillip Webb
2016-02-06 14:53:10 -08:00
parent 962a598531
commit 1cc1fc6431
97 changed files with 580 additions and 733 deletions

View File

@@ -25,10 +25,7 @@ import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(SampleCacheApplication.class)
@@ -43,11 +40,11 @@ public class SampleCacheApplicationTests {
@Test
public void validateCache() {
Cache countries = this.cacheManager.getCache("countries");
assertThat(countries, is(notNullValue()));
assertThat(countries).isNotNull();
countries.clear(); // Simple test assuming the cache is empty
assertThat(countries.get("BE"), is(nullValue()));
assertThat(countries.get("BE")).isNull();
Country be = this.countryRepository.findByCode("BE");
assertThat((Country) countries.get("BE").get(), is(be));
assertThat((Country) countries.get("BE").get()).isEqualTo(be);
}
}