aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorMichael Keppler <michael.keppler@gmx.de>2014-04-22 11:03:23 +0200
committerMichael Keppler <michael.keppler@gmx.de>2014-04-22 11:03:23 +0200
commit0e1262604f3a06469724b334a6f6268414e91fb8 (patch)
tree63e1b22e5dc4e9f5f76d1c29deda6fd01719463f /tests/src
parent8589d41a6a84c33bf0a4d6752483928aa3e5df67 (diff)
downloadcgeo-0e1262604f3a06469724b334a6f6268414e91fb8.zip
cgeo-0e1262604f3a06469724b334a6f6268414e91fb8.tar.gz
cgeo-0e1262604f3a06469724b334a6f6268414e91fb8.tar.bz2
fix #3697: have attended as log type on day of event
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/cgeo/geocaching/GeocacheTest.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/GeocacheTest.java b/tests/src/cgeo/geocaching/GeocacheTest.java
index b49048b..020cf6c 100644
--- a/tests/src/cgeo/geocaching/GeocacheTest.java
+++ b/tests/src/cgeo/geocaching/GeocacheTest.java
@@ -9,6 +9,7 @@ import cgeo.geocaching.list.StoredList;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
+import java.util.Calendar;
import java.util.Date;
import java.util.List;
@@ -285,4 +286,28 @@ public class GeocacheTest extends CGeoTestCase {
assertFalse("A traditional cache cannot have a webcam log", ocCache.getPossibleLogTypes().contains(LogType.WEBCAM_PHOTO_TAKEN));
assertFalse("OC caches have no maintenance log type", ocCache.getPossibleLogTypes().contains(LogType.NEEDS_MAINTENANCE));
}
+
+ public static void testLogTypeEventPast() throws Exception {
+ Calendar today = Calendar.getInstance();
+ today.add(Calendar.DAY_OF_MONTH, -1);
+ assertEquals(LogType.ATTENDED, createEventCache(today).getDefaultLogType());
+ }
+
+ public static void testLogTypeEventToday() throws Exception {
+ Calendar today = Calendar.getInstance();
+ assertEquals(LogType.ATTENDED, createEventCache(today).getDefaultLogType());
+ }
+
+ public static void testLogTypeEventFuture() throws Exception {
+ Calendar today = Calendar.getInstance();
+ today.add(Calendar.DAY_OF_MONTH, 1);
+ assertEquals(LogType.WILL_ATTEND, createEventCache(today).getDefaultLogType());
+ }
+
+ private static Geocache createEventCache(Calendar calendar) {
+ Geocache cache = new Geocache();
+ cache.setType(CacheType.EVENT);
+ cache.setHidden(calendar.getTime());
+ return cache;
+ }
}