aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichael Keppler <michael.keppler@gmx.de>2014-04-22 10:33:54 +0200
committerMichael Keppler <michael.keppler@gmx.de>2014-04-22 10:33:54 +0200
commit2c386f2b3eaf8a250d84361af67ce4f4f8e7a27b (patch)
tree0c9cb350a2d34083f410b207b0185a5a21e37557 /tests
parentb803878a41364159063094af402bf5a81ae3567a (diff)
downloadcgeo-2c386f2b3eaf8a250d84361af67ce4f4f8e7a27b.zip
cgeo-2c386f2b3eaf8a250d84361af67ce4f4f8e7a27b.tar.gz
cgeo-2c386f2b3eaf8a250d84361af67ce4f4f8e7a27b.tar.bz2
new test for DateUtils.isPastEvent
Diffstat (limited to 'tests')
-rw-r--r--tests/src/cgeo/geocaching/utils/DateUtilsTest.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/utils/DateUtilsTest.java b/tests/src/cgeo/geocaching/utils/DateUtilsTest.java
index 0a9d3e3..f82225a 100644
--- a/tests/src/cgeo/geocaching/utils/DateUtilsTest.java
+++ b/tests/src/cgeo/geocaching/utils/DateUtilsTest.java
@@ -1,5 +1,8 @@
package cgeo.geocaching.utils;
+import cgeo.geocaching.Geocache;
+import cgeo.geocaching.enumerations.CacheType;
+
import java.util.Calendar;
import junit.framework.TestCase;
@@ -14,4 +17,25 @@ public class DateUtilsTest extends TestCase {
}
}
+ public static void testIsPastEvent() {
+ final Calendar start = Calendar.getInstance();
+ start.set(Calendar.HOUR_OF_DAY, 0);
+ start.set(Calendar.MINUTE, 10);
+ assertPastEvent(start, false);
+
+ start.set(Calendar.HOUR_OF_DAY, 23);
+ assertPastEvent(start, false);
+
+ start.add(Calendar.DAY_OF_MONTH, -1);
+ assertPastEvent(start, true);
+ }
+
+ private static void assertPastEvent(final Calendar start, boolean expectedPast) {
+ final Geocache cache = new Geocache();
+ cache.setType(CacheType.EVENT);
+
+ cache.setHidden(start.getTime());
+ assertEquals(expectedPast, DateUtils.isPastEvent(cache));
+ }
+
}