diff options
Diffstat (limited to 'tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java')
| -rw-r--r-- | tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java b/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java index d98e33a..05d676b 100644 --- a/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java +++ b/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java @@ -1,5 +1,7 @@ package cgeo.geocaching.connector.oc; +import static org.assertj.core.api.Assertions.assertThat; + import cgeo.CGeoTestCase; import cgeo.geocaching.DataStore; import cgeo.geocaching.Geocache; @@ -10,38 +12,38 @@ public class OkapiClientTest extends CGeoTestCase { public static void testGetOCCache() { final String geoCode = "OU0331"; Geocache cache = OkapiClient.getCache(geoCode); - assertNotNull("Did not get cache from OKAPI", cache); + assertThat(cache).as("Cache from OKAPI").isNotNull(); assertEquals("Unexpected geo code", geoCode, cache.getGeocode()); - assertEquals("Oshkosh Municipal Tank", cache.getName()); - assertTrue(cache.isDetailed()); + assertThat(cache.getName()).isEqualTo("Oshkosh Municipal Tank"); + assertThat(cache.isDetailed()).isTrue(); // cache should be stored to DB (to listID 0) when loaded above cache = DataStore.loadCache(geoCode, LoadFlags.LOAD_ALL_DB_ONLY); - assertNotNull(cache); - assertEquals(geoCode, cache.getGeocode()); - assertEquals("Oshkosh Municipal Tank", cache.getName()); - assertTrue(cache.isDetailed()); + assertThat(cache).isNotNull(); + assertThat(cache.getGeocode()).isEqualTo(geoCode); + assertThat(cache.getName()).isEqualTo("Oshkosh Municipal Tank"); + assertThat(cache.isDetailed()).isTrue(); } public static void testOCSearchMustWorkWithoutOAuthAccessTokens() { final String geoCode = "OC1234"; Geocache cache = OkapiClient.getCache(geoCode); - assertNotNull("You must have a valid OKAPI key installed for running this test (but you do not need to set credentials in the app).", cache); - assertEquals("Wupper-Schein", cache.getName()); + assertThat(cache).overridingErrorMessage("You must have a valid OKAPI key installed for running this test (but you do not need to set credentials in the app).").isNotNull(); + assertThat(cache.getName()).isEqualTo("Wupper-Schein"); } public static void testOCCacheWithWaypoints() { final String geoCode = "OCDDD2"; removeCacheCompletely(geoCode); Geocache cache = OkapiClient.getCache(geoCode); - assertNotNull("Did not get cache from OKAPI", cache); + assertThat(cache).as("Cache from OKAPI").isNotNull(); // cache should be stored to DB (to listID 0) when loaded above cache = DataStore.loadCache(geoCode, LoadFlags.LOAD_ALL_DB_ONLY); - assertNotNull(cache); - assertEquals(3, cache.getWaypoints().size()); + assertThat(cache).isNotNull(); + assertThat(cache.getWaypoints()).hasSize(3); // load again cache.refreshSynchronous(cache.getListId(), null); - assertEquals(3, cache.getWaypoints().size()); + assertThat(cache.getWaypoints()).hasSize(3); } } |
