aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2012-03-08 20:16:01 +0100
committerBananeweizen <bananeweizen@gmx.de>2012-03-08 20:16:01 +0100
commit24b8acc8c252a94f14520f9d48a30bae3b3e6f5b (patch)
tree30cbb93db370200ce54ef9de61766c127f38bcf4 /tests/src/cgeo
parent43c16f1aea7b559196d27ccae18c6bfa950838bc (diff)
downloadcgeo-24b8acc8c252a94f14520f9d48a30bae3b3e6f5b.zip
cgeo-24b8acc8c252a94f14520f9d48a30bae3b3e6f5b.tar.gz
cgeo-24b8acc8c252a94f14520f9d48a30bae3b3e6f5b.tar.bz2
refactoring: make JSON parsing more robust by using a regex
Diffstat (limited to 'tests/src/cgeo')
-rw-r--r--tests/src/cgeo/geocaching/connector/gc/GCBaseTest.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/connector/gc/GCBaseTest.java b/tests/src/cgeo/geocaching/connector/gc/GCBaseTest.java
new file mode 100644
index 0000000..5f07f60
--- /dev/null
+++ b/tests/src/cgeo/geocaching/connector/gc/GCBaseTest.java
@@ -0,0 +1,14 @@
+package cgeo.geocaching.connector.gc;
+
+import java.util.Arrays;
+
+import junit.framework.TestCase;
+
+public class GCBaseTest extends TestCase {
+ public static void testSplitJSONKey() {
+ assertTrue(Arrays.equals(new int[] { 1, 2 }, GCBase.splitJSONKey("(1, 2)")));
+ assertTrue(Arrays.equals(new int[] { 12, 34 }, GCBase.splitJSONKey("(12, 34)")));
+ assertTrue(Arrays.equals(new int[] { 1234, 56 }, GCBase.splitJSONKey("(1234,56)")));
+ assertTrue(Arrays.equals(new int[] { 1234, 567 }, GCBase.splitJSONKey("(1234, 567)")));
+ }
+}