diff options
| -rw-r--r-- | main/src/cgeo/geocaching/export/GpxSerializer.java | 5 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/CgeoApplicationTest.java | 4 | ||||
| -rw-r--r-- | tests/src/cgeo/test/Compare.java | 6 |
3 files changed, 12 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/export/GpxSerializer.java b/main/src/cgeo/geocaching/export/GpxSerializer.java index 2afed44..df07f17 100644 --- a/main/src/cgeo/geocaching/export/GpxSerializer.java +++ b/main/src/cgeo/geocaching/export/GpxSerializer.java @@ -90,7 +90,10 @@ public final class GpxSerializer { private void exportBatch(final XmlSerializer gpx, Collection<String> geocodesOfBatch) throws IOException { final Set<Geocache> caches = DataStore.loadCaches(geocodesOfBatch, LoadFlags.LOAD_ALL_DB_ONLY); for (final Geocache cache : caches) { - final Geopoint coords = cache != null ? cache.getCoords() : null; + if (cache == null) { + continue; + } + final Geopoint coords = cache.getCoords(); if (coords == null) { // Export would be invalid without coordinates. continue; diff --git a/tests/src/cgeo/geocaching/CgeoApplicationTest.java b/tests/src/cgeo/geocaching/CgeoApplicationTest.java index 183b246..b9c03a4 100644 --- a/tests/src/cgeo/geocaching/CgeoApplicationTest.java +++ b/tests/src/cgeo/geocaching/CgeoApplicationTest.java @@ -26,7 +26,6 @@ import cgeo.geocaching.utils.CancellableHandler; import cgeo.geocaching.utils.Log; import cgeo.test.Compare; -import junit.framework.Assert; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -35,6 +34,8 @@ import android.test.suitebuilder.annotation.SmallTest; import java.util.GregorianCalendar; +import junit.framework.Assert; + /** * The c:geo application test. It can be used for tests that require an * application and/or context. @@ -72,6 +73,7 @@ public class CgeoApplicationTest extends CGeoTestCase { public static void testSearchTrackable() { final Trackable tb = GCParser.searchTrackable("TB2J1VZ", null, null); assertNotNull(tb); + assert (tb != null); // eclipse bug // fix data assertEquals("aefffb86-099f-444f-b132-605436163aa8", tb.getGuid()); assertEquals("TB2J1VZ", tb.getGeocode()); diff --git a/tests/src/cgeo/test/Compare.java b/tests/src/cgeo/test/Compare.java index 4a296bd..2ce8d49 100644 --- a/tests/src/cgeo/test/Compare.java +++ b/tests/src/cgeo/test/Compare.java @@ -11,6 +11,8 @@ import cgeo.geocaching.utils.CryptUtils; import org.apache.commons.lang3.StringUtils; +import java.util.Date; + public abstract class Compare { public static void assertCompareCaches(ICache expected, Geocache actual, boolean all) { @@ -27,7 +29,9 @@ public abstract class Compare { assertEquals("Cache " + geocode + ": name wrong", expected.getName(), actual.getName()); assertEquals("Cache " + geocode + ": guid wrong", expected.getGuid(), actual.getGuid()); assertTrue("Cache " + geocode + ": fav points wrong", expected.getFavoritePoints() <= actual.getFavoritePoints()); - assertEquals("Cache " + geocode + ": hidden date wrong", expected.getHiddenDate().toString(), actual.getHiddenDate().toString()); + final Date hiddenDate = actual.getHiddenDate(); + assertNotNull(hiddenDate); + assertEquals("Cache " + geocode + ": hidden date wrong", expected.getHiddenDate().toString(), hiddenDate.toString()); assertEquals("Cache " + geocode + ": premium only wrong", expected.isPremiumMembersOnly(), actual.isPremiumMembersOnly()); if (all) { |
