diff options
Diffstat (limited to 'tests/src/cgeo/geocaching/files/GPXParserTest.java')
| -rw-r--r-- | tests/src/cgeo/geocaching/files/GPXParserTest.java | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/tests/src/cgeo/geocaching/files/GPXParserTest.java b/tests/src/cgeo/geocaching/files/GPXParserTest.java index 6c3c237..bf09256 100644 --- a/tests/src/cgeo/geocaching/files/GPXParserTest.java +++ b/tests/src/cgeo/geocaching/files/GPXParserTest.java @@ -4,8 +4,8 @@ import cgeo.geocaching.LogEntry; import cgeo.geocaching.SearchResult; import cgeo.geocaching.StoredList; import cgeo.geocaching.cgCache; +import cgeo.geocaching.cgData; import cgeo.geocaching.cgWaypoint; -import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.enumerations.CacheSize; import cgeo.geocaching.enumerations.CacheType; import cgeo.geocaching.enumerations.LoadFlags; @@ -24,10 +24,11 @@ import java.util.Collection; import java.util.EnumSet; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Set; public class GPXParserTest extends AbstractResourceInstrumentationTestCase { - private static final SimpleDateFormat LOG_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); // 2010-04-20T07:00:00Z + private static final SimpleDateFormat LOG_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US); // 2010-04-20T07:00:00Z private int listId; public void testGPXVersion100() throws Exception { @@ -212,29 +213,19 @@ public class GPXParserTest extends AbstractResourceInstrumentationTestCase { } } // reload caches, because the parser only returns the minimum version of each cache - return new ArrayList<cgCache>(cgeoapplication.getInstance().loadCaches(result, LoadFlags.LOAD_ALL_DB_ONLY)); + return new ArrayList<cgCache>(cgData.loadCaches(result, LoadFlags.LOAD_ALL_DB_ONLY)); } - public static void testParseDateWithFractionalSeconds() { + public static void testParseDateWithFractionalSeconds() throws ParseException { // was experienced in GSAK file final String dateString = "2011-08-13T02:52:18.103Z"; - try { - GPXParser.parseDate(dateString); - } catch (ParseException e) { - fail(); - e.printStackTrace(); - } + GPXParser.parseDate(dateString); } - public static void testParseDateWithHugeFraction() { + public static void testParseDateWithHugeFraction() throws ParseException { // see issue 821 String dateString = "2011-11-07T00:00:00.0000000-07:00"; - try { - GPXParser.parseDate(dateString); - } catch (ParseException e) { - fail(); - e.printStackTrace(); - } + GPXParser.parseDate(dateString); } public void testSelfmadeGPXWithoutGeocodes() throws Exception { @@ -265,10 +256,9 @@ public class GPXParserTest extends AbstractResourceInstrumentationTestCase { removeCacheCompletely(geocode); final List<cgCache> caches = readGPX10(R.raw.lazy); assertEquals(1, caches.size()); - cgeoapplication.getInstance().removeAllFromCache(); - + cgData.removeAllFromCache(); // load only the minimum cache, it has several members missing - final cgCache minimalCache = cgeoapplication.getInstance().loadCache(geocode, EnumSet.of(LoadFlag.LOAD_DB_MINIMAL)); + final cgCache minimalCache = cgData.loadCache(geocode, EnumSet.of(LoadFlag.LOAD_DB_MINIMAL)); // now check that we load lazy members on demand assertFalse(minimalCache.getAttributes().isEmpty()); @@ -297,17 +287,17 @@ public class GPXParserTest extends AbstractResourceInstrumentationTestCase { @Override protected void setUp() throws Exception { super.setUp(); - listId = cgeoapplication.getInstance().createList("Temporary unit testing"); + listId = cgData.createList("Temporary unit testing"); assertTrue(listId != StoredList.TEMPORARY_LIST_ID); assertTrue(listId != StoredList.STANDARD_LIST_ID); } @Override protected void tearDown() throws Exception { - SearchResult search = cgeoapplication.getInstance().getBatchOfStoredCaches(false, null, CacheType.ALL, listId); + SearchResult search = cgData.getBatchOfStoredCaches(null, CacheType.ALL, listId); assertNotNull(search); - cgeoapplication.getInstance().removeCaches(search.getGeocodes(), LoadFlags.REMOVE_ALL); - cgeoapplication.getInstance().removeList(listId); + cgData.removeCaches(search.getGeocodes(), LoadFlags.REMOVE_ALL); + cgData.removeList(listId); super.tearDown(); } } |
