diff options
Diffstat (limited to 'tests/src/cgeo/geocaching/files/LocParserTest.java')
| -rw-r--r-- | tests/src/cgeo/geocaching/files/LocParserTest.java | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/tests/src/cgeo/geocaching/files/LocParserTest.java b/tests/src/cgeo/geocaching/files/LocParserTest.java index 3039a1f..d87b593 100644 --- a/tests/src/cgeo/geocaching/files/LocParserTest.java +++ b/tests/src/cgeo/geocaching/files/LocParserTest.java @@ -1,5 +1,7 @@ package cgeo.geocaching.files; +import static org.assertj.core.api.Assertions.assertThat; + import cgeo.geocaching.Geocache; import cgeo.geocaching.enumerations.CacheSize; import cgeo.geocaching.enumerations.CacheType; @@ -20,8 +22,8 @@ public class LocParserTest extends AbstractResourceInstrumentationTestCase { final InputStream instream = getResourceStream(resourceId); try { caches = parser.parse(instream, null); - assertNotNull(caches); - assertTrue(caches.size() > 0); + assertThat(caches).isNotNull(); + assertThat(caches.size() > 0).isTrue(); } finally { instream.close(); } @@ -31,42 +33,42 @@ public class LocParserTest extends AbstractResourceInstrumentationTestCase { public void testOCLoc() throws IOException, ParserException { final List<Geocache> caches = readLoc(R.raw.oc5952_loc); - assertEquals(1, caches.size()); + assertThat(caches).hasSize(1); final Geocache cache = caches.get(0); - assertNotNull(cache); - assertEquals("OC5952", cache.getGeocode()); - assertEquals("Die Schatzinsel / treasure island", cache.getName()); - assertEquals("Die unbesiegbaren Geo - Geparden", cache.getOwnerUserId()); + assertThat(cache).isNotNull(); + assertThat(cache.getGeocode()).isEqualTo("OC5952"); + assertThat(cache.getName()).isEqualTo("Die Schatzinsel / treasure island"); + assertThat(cache.getOwnerUserId()).isEqualTo("Die unbesiegbaren Geo - Geparden"); assertEquals(new Geopoint(48.85968, 9.18740), cache.getCoords()); } public void testGCLoc() throws IOException, ParserException { final List<Geocache> caches = readLoc(R.raw.gc1bkp3_loc); - assertEquals(1, caches.size()); + assertThat(caches).hasSize(1); final Geocache cache = caches.get(0); - assertNotNull(cache); - assertEquals("GC1BKP3", cache.getGeocode()); - assertEquals("Die Schatzinsel / treasure island", cache.getName()); - assertEquals("Die unbesiegbaren Geo - Geparden", cache.getOwnerUserId()); + assertThat(cache).isNotNull(); + assertThat(cache.getGeocode()).isEqualTo("GC1BKP3"); + assertThat(cache.getName()).isEqualTo("Die Schatzinsel / treasure island"); + assertThat(cache.getOwnerUserId()).isEqualTo("Die unbesiegbaren Geo - Geparden"); assertEquals(new Geopoint(48.859683, 9.1874), cache.getCoords()); - assertEquals(1.0f, cache.getDifficulty()); - assertEquals(5.0f, cache.getTerrain()); - assertEquals(CacheSize.MICRO, cache.getSize()); + assertThat(cache.getDifficulty()).isEqualTo(1.0f); + assertThat(cache.getTerrain()).isEqualTo(5.0f); + assertThat(cache.getSize()).isEqualTo(CacheSize.MICRO); } public void testWaymarkingLoc() throws IOException, ParserException { final List<Geocache> waymarks = readLoc(R.raw.waymarking_loc); - assertEquals(1, waymarks.size()); + assertThat(waymarks).hasSize(1); final Geocache waymark = waymarks.get(0); - assertNotNull(waymark); - assertEquals("WM7BK7", waymark.getGeocode()); - assertEquals("Römerstrasse Kornwestheim", waymark.getName()); - assertEquals("travelling", waymark.getOwnerUserId()); + assertThat(waymark).isNotNull(); + assertThat(waymark.getGeocode()).isEqualTo("WM7BK7"); + assertThat(waymark.getName()).isEqualTo("Römerstrasse Kornwestheim"); + assertThat(waymark.getOwnerUserId()).isEqualTo("travelling"); assertEquals(new Geopoint(48.856733, 9.197683), waymark.getCoords()); // links are not yet stored for single caches - // assertEquals("http://www.waymarking.com/waymarks/WM7BK7_Rmerstrasse_Kornwestheim", waymark.getUrl()); - assertEquals(CacheSize.UNKNOWN, waymark.getSize()); - assertEquals(CacheType.UNKNOWN, waymark.getType()); + // assertThat(waymark.getUrl()).isEqualTo("http://www.waymarking.com/waymarks/WM7BK7_Rmerstrasse_Kornwestheim"); + assertThat(waymark.getSize()).isEqualTo(CacheSize.UNKNOWN); + assertThat(waymark.getType()).isEqualTo(CacheType.UNKNOWN); } } |
