aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/CGeoTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/cgeo/CGeoTestCase.java')
-rw-r--r--tests/src/cgeo/CGeoTestCase.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/src/cgeo/CGeoTestCase.java b/tests/src/cgeo/CGeoTestCase.java
index 5759bc7..7fc1e8d 100644
--- a/tests/src/cgeo/CGeoTestCase.java
+++ b/tests/src/cgeo/CGeoTestCase.java
@@ -2,6 +2,7 @@ package cgeo;
import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.DataStore;
+import cgeo.geocaching.Geocache;
import cgeo.geocaching.enumerations.LoadFlags;
import cgeo.geocaching.enumerations.LoadFlags.RemoveFlag;
import cgeo.geocaching.settings.Settings;
@@ -44,6 +45,17 @@ public abstract class CGeoTestCase extends ApplicationTestCase<CgeoApplication>
}
/**
+ * Remove completely the previous instance of a cache, then save this object into the database
+ * and the cache cache.
+ *
+ * @param cache the fresh cache to save
+ */
+ protected static void saveFreshCacheToDB(final Geocache cache) {
+ removeCacheCompletely(cache.getGeocode());
+ DataStore.saveCache(cache, LoadFlags.SAVE_ALL);
+ }
+
+ /**
* must be called once before setting the flags
* can be called again after restoring the flags
*/