From cc9aa8b1d2b9ec24f2c41e4a523c69edcf8c8ac0 Mon Sep 17 00:00:00 2001 From: Michael Keppler Date: Tue, 22 Apr 2014 17:30:51 +0200 Subject: #2414 convert junit statements to assertj This conversion is not complete, but the remaining statements are hard to catch with regular expressions automatically. --- .../src/cgeo/geocaching/export/GpxSerializerTest.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'tests/src/cgeo/geocaching/export/GpxSerializerTest.java') diff --git a/tests/src/cgeo/geocaching/export/GpxSerializerTest.java b/tests/src/cgeo/geocaching/export/GpxSerializerTest.java index 9e3c3a4..f64796a 100644 --- a/tests/src/cgeo/geocaching/export/GpxSerializerTest.java +++ b/tests/src/cgeo/geocaching/export/GpxSerializerTest.java @@ -1,5 +1,7 @@ package cgeo.geocaching.export; +import static org.assertj.core.api.Assertions.assertThat; + import cgeo.geocaching.Geocache; import cgeo.geocaching.files.GPX10Parser; import cgeo.geocaching.files.ParserException; @@ -22,15 +24,14 @@ public class GpxSerializerTest extends AbstractResourceInstrumentationTestCase { public static void testWriteEmptyGPX() throws Exception { final StringWriter writer = new StringWriter(); new GpxSerializer().writeGPX(Collections. emptyList(), writer, null); - assertEquals("" + + assertThat(writer.getBuffer().toString()).isEqualTo("" + "", - writer.getBuffer().toString()); + "xmlns:cgeo=\"http://www.cgeo.org/wptext/1/0\" />"); } public void testProgressReporting() throws IOException, ParserException { @@ -38,7 +39,7 @@ public class GpxSerializerTest extends AbstractResourceInstrumentationTestCase { final StringWriter writer = new StringWriter(); Geocache cache = loadCacheFromResource(R.raw.gc1bkp3_gpx101); - assertNotNull(cache); + assertThat(cache).isNotNull(); new GpxSerializer().writeGPX(Collections.singletonList("GC1BKP3"), writer, new GpxSerializer.ProgressListener() { @@ -60,21 +61,21 @@ public class GpxSerializerTest extends AbstractResourceInstrumentationTestCase { final String geocode = "GC1BKP3"; final int cacheResource = R.raw.gc1bkp3_gpx101; final Geocache cache = loadCacheFromResource(cacheResource); - assertNotNull(cache); + assertThat(cache).isNotNull(); final String gpxFirst = getGPXFromCache(geocode); - assertTrue(gpxFirst.length() > 0); + assertThat(gpxFirst.length() > 0).isTrue(); final GPX10Parser parser = new GPX10Parser(StoredList.TEMPORARY_LIST_ID); final InputStream stream = new ByteArrayInputStream(gpxFirst.getBytes(CharEncoding.UTF_8)); Collection caches = parser.parse(stream, null); - assertNotNull(caches); - assertEquals(1, caches.size()); + assertThat(caches).isNotNull(); + assertThat(caches).hasSize(1); final String gpxSecond = getGPXFromCache(geocode); - assertEquals(replaceLogIds(gpxFirst), replaceLogIds(gpxSecond)); + assertThat(replaceLogIds(gpxSecond)).isEqualTo(replaceLogIds(gpxFirst)); } private static String replaceLogIds(String gpx) { -- cgit v1.1