aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/twitter/TwitterTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/cgeo/geocaching/twitter/TwitterTest.java')
-rw-r--r--tests/src/cgeo/geocaching/twitter/TwitterTest.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/twitter/TwitterTest.java b/tests/src/cgeo/geocaching/twitter/TwitterTest.java
new file mode 100644
index 0000000..a27e57a
--- /dev/null
+++ b/tests/src/cgeo/geocaching/twitter/TwitterTest.java
@@ -0,0 +1,37 @@
+package cgeo.geocaching.twitter;
+
+import cgeo.geocaching.Geocache;
+import cgeo.geocaching.Settings;
+import cgeo.geocaching.Trackable;
+
+import junit.framework.TestCase;
+
+public class TwitterTest extends TestCase {
+
+ public static void testTrackableMessage() {
+ Trackable tb = new Trackable();
+ tb.setName("Travel bug");
+ tb.setGeocode("TB1234");
+ assertEquals("I touched Travel bug (http://www.geocaching.com//track/details.aspx?tracker=TB1234)! #cgeo #geocaching", Twitter.getStatusMessage(tb));
+ }
+
+ public static void testCacheMessage() {
+ Geocache cache = new Geocache();
+ cache.setGeocode("GC1234");
+ cache.setName("TwitterTest");
+ assertEquals("I found TwitterTest (http://coord.info/GC1234) #cgeo #geocaching", Twitter.getStatusMessage(cache));
+ }
+
+ public static void testAvoidDuplicateTags() {
+ String oldMessage = Settings.getCacheTwitterMessage();
+ try {
+ Geocache cache = new Geocache();
+ cache.setGeocode("GC1234");
+ cache.setName("TwitterTest");
+ Settings.setCacheTwitterMessage("[NAME] #cgeo");
+ assertEquals("TwitterTest #cgeo #geocaching", Twitter.getStatusMessage(cache));
+ } finally {
+ Settings.setCacheTwitterMessage(oldMessage);
+ }
+ }
+}