From cf839616a5a195052ea602ecf7abf14209c8a980 Mon Sep 17 00:00:00 2001 From: Bananeweizen Date: Wed, 12 Jun 2013 19:38:44 +0200 Subject: refactoring: fix name of test case --- tests/src/cgeo/geocaching/CacheTest.java | 50 ----------------------------- tests/src/cgeo/geocaching/GeocacheTest.java | 50 +++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 50 deletions(-) delete mode 100644 tests/src/cgeo/geocaching/CacheTest.java create mode 100644 tests/src/cgeo/geocaching/GeocacheTest.java diff --git a/tests/src/cgeo/geocaching/CacheTest.java b/tests/src/cgeo/geocaching/CacheTest.java deleted file mode 100644 index 20c7d9e..0000000 --- a/tests/src/cgeo/geocaching/CacheTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package cgeo.geocaching; - -import cgeo.geocaching.enumerations.CacheType; - -import android.test.AndroidTestCase; - -import java.util.Date; - -public class CacheTest extends AndroidTestCase { - - final static private class MockedEventCache extends Geocache { - public MockedEventCache(final Date date) { - setHidden(date); - setType(CacheType.EVENT); - } - } - - public static void testCanBeAddedToCalendar() { - final Date today = new Date(); - final Geocache cacheToday = new MockedEventCache(today); - assertTrue(cacheToday.canBeAddedToCalendar()); - - final Date yesterday = new Date(today.getTime() - 86400 * 1000); - final MockedEventCache cacheYesterday = new MockedEventCache(yesterday); - assertFalse(cacheYesterday.canBeAddedToCalendar()); - } - - public static void testEquality() { - final Geocache one = new Geocache(); - final Geocache two = new Geocache(); - - // identity - assertTrue(one.equals(one)); - - // different objects without geocode shall not be equal - assertFalse(one.equals(two)); - - one.setGeocode("geocode"); - two.setGeocode("geocode"); - - // different objects with same geocode shall be equal - assertTrue(one.equals(two)); - } - - public static void testGeocodeUppercase() { - final Geocache cache = new Geocache(); - cache.setGeocode("gc1234"); - assertEquals("GC1234", cache.getGeocode()); - } -} diff --git a/tests/src/cgeo/geocaching/GeocacheTest.java b/tests/src/cgeo/geocaching/GeocacheTest.java new file mode 100644 index 0000000..f3c9a65 --- /dev/null +++ b/tests/src/cgeo/geocaching/GeocacheTest.java @@ -0,0 +1,50 @@ +package cgeo.geocaching; + +import cgeo.geocaching.enumerations.CacheType; + +import android.test.AndroidTestCase; + +import java.util.Date; + +public class GeocacheTest extends AndroidTestCase { + + final static private class MockedEventCache extends Geocache { + public MockedEventCache(final Date date) { + setHidden(date); + setType(CacheType.EVENT); + } + } + + public static void testCanBeAddedToCalendar() { + final Date today = new Date(); + final Geocache cacheToday = new MockedEventCache(today); + assertTrue(cacheToday.canBeAddedToCalendar()); + + final Date yesterday = new Date(today.getTime() - 86400 * 1000); + final MockedEventCache cacheYesterday = new MockedEventCache(yesterday); + assertFalse(cacheYesterday.canBeAddedToCalendar()); + } + + public static void testEquality() { + final Geocache one = new Geocache(); + final Geocache two = new Geocache(); + + // identity + assertTrue(one.equals(one)); + + // different objects without geocode shall not be equal + assertFalse(one.equals(two)); + + one.setGeocode("geocode"); + two.setGeocode("geocode"); + + // different objects with same geocode shall be equal + assertTrue(one.equals(two)); + } + + public static void testGeocodeUppercase() { + final Geocache cache = new Geocache(); + cache.setGeocode("gc1234"); + assertEquals("GC1234", cache.getGeocode()); + } +} -- cgit v1.1