aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/connector/gc
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2013-09-15 20:16:42 +0200
committerBananeweizen <bananeweizen@gmx.de>2013-09-15 20:16:42 +0200
commit46b5dd9f3a7e482e451744ff9ea71919b83f5801 (patch)
treeb9572a348745714e2744e9de5a3521a108cd5fff /tests/src/cgeo/geocaching/connector/gc
parentb45726aaab73836b1c69e14ff0f053975e427bb4 (diff)
downloadcgeo-46b5dd9f3a7e482e451744ff9ea71919b83f5801.zip
cgeo-46b5dd9f3a7e482e451744ff9ea71919b83f5801.tar.gz
cgeo-46b5dd9f3a7e482e451744ff9ea71919b83f5801.tar.bz2
assertion badly triggered in tests of UTFGridPosition
* convert assertion to exception, as nobody noticed this before * move tests to where they belong
Diffstat (limited to 'tests/src/cgeo/geocaching/connector/gc')
-rw-r--r--tests/src/cgeo/geocaching/connector/gc/GCBaseTest.java13
-rw-r--r--tests/src/cgeo/geocaching/connector/gc/UTFGridPositionTest.java34
2 files changed, 34 insertions, 13 deletions
diff --git a/tests/src/cgeo/geocaching/connector/gc/GCBaseTest.java b/tests/src/cgeo/geocaching/connector/gc/GCBaseTest.java
index d70ab9b..29fd886 100644
--- a/tests/src/cgeo/geocaching/connector/gc/GCBaseTest.java
+++ b/tests/src/cgeo/geocaching/connector/gc/GCBaseTest.java
@@ -14,19 +14,6 @@ import junit.framework.TestCase;
public class GCBaseTest extends TestCase {
- public static void testSplitJSONKey() {
- assertKey("(1, 2)", 1, 2);
- assertKey("(12, 34)", 12, 34);
- assertKey("(1234,56)", 1234, 56);
- assertKey("(1234, 567)", 1234, 567);
- }
-
- private static void assertKey(String key, int x, int y) {
- final UTFGridPosition pos = UTFGridPosition.fromString(key);
- assertEquals(x, pos.getX());
- assertEquals(y, pos.getY());
- }
-
public static void testSearchFromMap() {
final MockedCache mockedCache = new GC2CJPF();
diff --git a/tests/src/cgeo/geocaching/connector/gc/UTFGridPositionTest.java b/tests/src/cgeo/geocaching/connector/gc/UTFGridPositionTest.java
new file mode 100644
index 0000000..a742faf
--- /dev/null
+++ b/tests/src/cgeo/geocaching/connector/gc/UTFGridPositionTest.java
@@ -0,0 +1,34 @@
+package cgeo.geocaching.connector.gc;
+
+import junit.framework.TestCase;
+
+public class UTFGridPositionTest extends TestCase {
+
+ public static void testValidUTFGridPosition() {
+ assertNotNull(new UTFGridPosition(0, 0));
+ }
+
+ public static void testInvalidUTFGridPosition() {
+ boolean valid = true;
+ try {
+ assertNotNull(new UTFGridPosition(-1, 0));
+ } catch (Exception e) {
+ valid = false;
+ }
+ assertFalse(valid);
+ }
+
+ public static void testFromString() throws Exception {
+ assertXYFromString("(1, 2)", 1, 2);
+ assertXYFromString("(12, 34)", 12, 34);
+ assertXYFromString("(34,56)", 34, 56);
+ assertXYFromString("(34, 56)", 34, 56);
+ }
+
+ private static void assertXYFromString(final String key, int x, int y) {
+ final UTFGridPosition pos = UTFGridPosition.fromString(key);
+ assertEquals(x, pos.getX());
+ assertEquals(y, pos.getY());
+ }
+
+}