diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2012-04-23 07:50:26 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2012-04-23 07:50:26 +0200 |
| commit | d2fba594dfea96b17ab01bb12afbc37ec10fe251 (patch) | |
| tree | 2e272eae1a0eeadc9213e8059f8f1d6dc381e048 /tests | |
| parent | 0d19a993a9d2e99bd4f0627d182870ee1606cb91 (diff) | |
| download | cgeo-d2fba594dfea96b17ab01bb12afbc37ec10fe251.zip cgeo-d2fba594dfea96b17ab01bb12afbc37ec10fe251.tar.gz cgeo-d2fba594dfea96b17ab01bb12afbc37ec10fe251.tar.bz2 | |
refactoring of database access
* use only one transaction when saving a cache
* rework some methods to always take a collection of objects instead of
calling the database multiple times
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/src/cgeo/geocaching/cgDataTest.java | 7 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/files/GPXParserTest.java | 6 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/files/LocParserTest.java | 4 |
3 files changed, 9 insertions, 8 deletions
diff --git a/tests/src/cgeo/geocaching/cgDataTest.java b/tests/src/cgeo/geocaching/cgDataTest.java index d6bb389..3ce6431 100644 --- a/tests/src/cgeo/geocaching/cgDataTest.java +++ b/tests/src/cgeo/geocaching/cgDataTest.java @@ -6,6 +6,7 @@ import cgeo.geocaching.enumerations.LoadFlags; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.geopoint.Viewport; +import java.util.Collections; import java.util.HashSet; import java.util.Set; @@ -51,17 +52,17 @@ public class cgDataTest extends CGeoTestCase { assertEquals("cgData Test (renamed)", list1.title); // move to list (cache1=listId2, cache2=listId2) - app.moveToList(cache1.getGeocode(), listId2); + app.moveToList(Collections.singletonList(cache1), listId2); assertEquals(1, app.getAllStoredCachesCount(false, CacheType.ALL, listId2)); // remove list (cache1=listId2, cache2=listId2) assertTrue(app.removeList(listId1)); // mark dropped (cache1=1, cache2=0) - app.markDropped(cache2.getGeocode()); + app.markDropped(Collections.singletonList(cache2)); // mark stored (cache1=1, cache2=listId2) - app.markStored(cache2.getGeocode(), listId2); + app.markStored(Collections.singletonList(cache2), listId2); assertEquals(2, app.getAllStoredCachesCount(false, CacheType.ALL, listId2)); // drop stored (cache1=0, cache2=0) diff --git a/tests/src/cgeo/geocaching/files/GPXParserTest.java b/tests/src/cgeo/geocaching/files/GPXParserTest.java index 634c551..f37f327 100644 --- a/tests/src/cgeo/geocaching/files/GPXParserTest.java +++ b/tests/src/cgeo/geocaching/files/GPXParserTest.java @@ -1,7 +1,7 @@ package cgeo.geocaching.files; -import cgeo.geocaching.cgCache; import cgeo.geocaching.LogEntry; +import cgeo.geocaching.cgCache; import cgeo.geocaching.cgWaypoint; import cgeo.geocaching.enumerations.CacheSize; import cgeo.geocaching.enumerations.CacheType; @@ -42,7 +42,7 @@ public class GPXParserTest extends AbstractResourceInstrumentationTestCase { assertEquals(5.0f, cache.getTerrain()); assertEquals("Baden-Württemberg, Germany", cache.getLocation()); assertEquals("Ein alter Kindheitstraum, ein Schatz auf einer unbewohnten Insel.\nA old dream of my childhood, a treasure on a lonely island.", cache.getShortdesc()); - assertTrue(new Geopoint(48.859683, 9.1874).equals(cache.getCoords())); + assertEquals(new Geopoint(48.859683, 9.1874), cache.getCoords()); return cache; } @@ -66,7 +66,7 @@ public class GPXParserTest extends AbstractResourceInstrumentationTestCase { assertEquals(4.0f, cache.getTerrain()); assertEquals("Baden-Württemberg, Germany", cache.getLocation()); assertEquals("Ein alter Kindheitstraum, ein Schatz auf einer unbewohnten Insel. A old dream of my childhood, a treasure on a lonely is", cache.getShortdesc()); - assertTrue(new Geopoint(48.85968, 9.18740).equals(cache.getCoords())); + assertEquals(new Geopoint(48.85968, 9.18740), cache.getCoords()); assertTrue(cache.isReliableLatLon()); } diff --git a/tests/src/cgeo/geocaching/files/LocParserTest.java b/tests/src/cgeo/geocaching/files/LocParserTest.java index ede0e81..6cd6c7b 100644 --- a/tests/src/cgeo/geocaching/files/LocParserTest.java +++ b/tests/src/cgeo/geocaching/files/LocParserTest.java @@ -37,7 +37,7 @@ public class LocParserTest extends AbstractResourceInstrumentationTestCase { assertNotNull(cache); assertEquals("OC5952", cache.getGeocode()); assertEquals("Die Schatzinsel / treasure island", cache.getName()); - assertTrue(new Geopoint(48.85968, 9.18740).equals(cache.getCoords())); + assertEquals(new Geopoint(48.85968, 9.18740), cache.getCoords()); } public void testGCLoc() throws IOException, ParserException { @@ -47,7 +47,7 @@ public class LocParserTest extends AbstractResourceInstrumentationTestCase { assertNotNull(cache); assertEquals("GC1BKP3", cache.getGeocode()); assertEquals("Die Schatzinsel / treasure island", cache.getName()); - assertTrue(new Geopoint(48.859683, 9.1874).equals(cache.getCoords())); + assertEquals(new Geopoint(48.859683, 9.1874), cache.getCoords()); assertEquals(1.0f, cache.getDifficulty()); assertEquals(5.0f, cache.getTerrain()); assertEquals(CacheSize.MICRO, cache.getSize()); |
