diff options
author | campbeb <bpcampbell@gmail.com> | 2012-05-12 17:17:00 +0900 |
---|---|---|
committer | campbeb <bpcampbell@gmail.com> | 2012-05-12 17:17:00 +0900 |
commit | 86f4fd44a2b263a6ce44ae66e5769af53488a783 (patch) | |
tree | b3c95434548da3e8d86d2f02002ba7f5e2104348 /tests/src/cgeo | |
parent | bc8cad624ff92c2efe75115376cf315a208384b2 (diff) | |
download | cgeo-86f4fd44a2b263a6ce44ae66e5769af53488a783.zip cgeo-86f4fd44a2b263a6ce44ae66e5769af53488a783.tar.gz cgeo-86f4fd44a2b263a6ce44ae66e5769af53488a783.tar.bz2 |
Add tests to very trackable logs can be parsed
Diffstat (limited to 'tests/src/cgeo')
-rw-r--r-- | tests/src/cgeo/geocaching/cgeoApplicationTest.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/src/cgeo/geocaching/cgeoApplicationTest.java b/tests/src/cgeo/geocaching/cgeoApplicationTest.java index df94502..e34fe76 100644 --- a/tests/src/cgeo/geocaching/cgeoApplicationTest.java +++ b/tests/src/cgeo/geocaching/cgeoApplicationTest.java @@ -9,6 +9,7 @@ import cgeo.geocaching.connector.gc.Tile; import cgeo.geocaching.enumerations.CacheType; import cgeo.geocaching.enumerations.LiveMapStrategy.Strategy; import cgeo.geocaching.enumerations.LoadFlags; +import cgeo.geocaching.enumerations.LogType; import cgeo.geocaching.enumerations.StatusCode; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.geopoint.Viewport; @@ -21,6 +22,7 @@ import cgeo.geocaching.utils.CancellableHandler; import cgeo.geocaching.utils.Log; import cgeo.test.Compare; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import android.test.suitebuilder.annotation.MediumTest; @@ -63,7 +65,7 @@ public class cgeoApplicationTest extends CGeoTestCase { */ @MediumTest public static void testSearchTrackable() { - cgTrackable tb = GCParser.searchTrackable("TB2J1VZ", null, null); + final cgTrackable tb = GCParser.searchTrackable("TB2J1VZ", null, null); // fix data assertEquals("aefffb86-099f-444f-b132-605436163aa8", tb.getGuid()); assertEquals("TB2J1VZ", tb.getGeocode()); @@ -83,6 +85,18 @@ public class cgeoApplicationTest extends CGeoTestCase { assertTrue(cgTrackable.SPOTTED_CACHE == tb.getSpottedType() || cgTrackable.SPOTTED_USER == tb.getSpottedType()); // no assumption possible: assertEquals("faa2d47d-19ea-422f-bec8-318fc82c8063", tb.getSpottedGuid()); // no assumption possible: assertEquals("Nice place for a break cache", tb.getSpottedName()); + + // we can't check specifics in the log entries since they change, but we can verify data was parsed + for (LogEntry log : tb.getLogs()) { + assertTrue(log.date > 0); + assertTrue(StringUtils.isNotEmpty(log.author)); + if (log.type == LogType.PLACED_IT || log.type == LogType.RETRIEVED_IT) { + assertTrue(StringUtils.isNotEmpty(log.cacheName)); + assertTrue(StringUtils.isNotEmpty(log.cacheGuid)); + } else { + assertTrue(log.type != LogType.UNKNOWN); + } + } } /** |