aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/test
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2011-09-23 23:44:32 +0200
committerSamuel Tardieu <sam@rfc1149.net>2011-09-26 08:55:08 +0200
commitd5082b9daece1bffaeb259352bf7045100d3ac06 (patch)
treec3f454e52445083a69fb39407df8e01708aeb112 /tests/src/cgeo/geocaching/test
parent367a174596cbc5b50b693beb4b25d7326913d268 (diff)
downloadcgeo-d5082b9daece1bffaeb259352bf7045100d3ac06.zip
cgeo-d5082b9daece1bffaeb259352bf7045100d3ac06.tar.gz
cgeo-d5082b9daece1bffaeb259352bf7045100d3ac06.tar.bz2
Add test for cgBase utilities
Diffstat (limited to 'tests/src/cgeo/geocaching/test')
-rw-r--r--tests/src/cgeo/geocaching/test/cgBaseTest.java16
-rw-r--r--tests/src/cgeo/geocaching/test/mock/MockedCache.java5
2 files changed, 17 insertions, 4 deletions
diff --git a/tests/src/cgeo/geocaching/test/cgBaseTest.java b/tests/src/cgeo/geocaching/test/cgBaseTest.java
new file mode 100644
index 0000000..573883e
--- /dev/null
+++ b/tests/src/cgeo/geocaching/test/cgBaseTest.java
@@ -0,0 +1,16 @@
+package cgeo.geocaching.test;
+
+import cgeo.geocaching.cgBase;
+
+import android.test.AndroidTestCase;
+
+import junit.framework.Assert;
+
+public class cgBaseTest extends AndroidTestCase {
+
+ public void testReplaceWhitespaces() {
+ StringBuffer buffer = new StringBuffer(" foo\n\tbar \r baz ");
+ Assert.assertEquals("foo bar baz", cgBase.replaceWhitespace(buffer));
+ }
+
+}
diff --git a/tests/src/cgeo/geocaching/test/mock/MockedCache.java b/tests/src/cgeo/geocaching/test/mock/MockedCache.java
index 7494028..2ed8856 100644
--- a/tests/src/cgeo/geocaching/test/mock/MockedCache.java
+++ b/tests/src/cgeo/geocaching/test/mock/MockedCache.java
@@ -28,10 +28,7 @@ public abstract class MockedCache implements ICache {
}
br.close();
-
- cgBase.replaceWhitespace(buffer);
- return buffer.toString();
-
+ return cgBase.replaceWhitespace(buffer);
} catch (IOException e) {
e.printStackTrace();
}