diff options
Diffstat (limited to 'tests/src/cgeo/geocaching/twitter/TwitterTest.java')
| -rw-r--r-- | tests/src/cgeo/geocaching/twitter/TwitterTest.java | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/tests/src/cgeo/geocaching/twitter/TwitterTest.java b/tests/src/cgeo/geocaching/twitter/TwitterTest.java index 89ac456..7ce0f09 100644 --- a/tests/src/cgeo/geocaching/twitter/TwitterTest.java +++ b/tests/src/cgeo/geocaching/twitter/TwitterTest.java @@ -2,36 +2,48 @@ package cgeo.geocaching.twitter; import cgeo.geocaching.Geocache; import cgeo.geocaching.Trackable; +import cgeo.geocaching.settings.Settings; import junit.framework.TestCase; public class TwitterTest extends TestCase { public static void testTrackableMessage() { + final String oldMessage = Settings.getTrackableTwitterMessage(); + try { + Settings.setTrackableTwitterMessage("I touched [NAME] ([URL])."); 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)); + assertEquals("I touched Travel bug (http://www.geocaching.com//track/details.aspx?tracker=TB1234). #cgeo #geocaching", Twitter.getStatusMessage(tb)); + } finally { + Settings.setTrackableTwitterMessage(oldMessage); + } } 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)); + final String oldMessage = Settings.getCacheTwitterMessage(); + try { + Settings.setCacheTwitterMessage("I found [NAME] ([URL])."); + Geocache cache = new Geocache(); + cache.setGeocode("GC1234"); + cache.setName("TwitterTest"); + assertEquals("I found TwitterTest (http://coord.info/GC1234). #cgeo #geocaching", Twitter.getStatusMessage(cache)); + } finally { + Settings.setCacheTwitterMessage(oldMessage); + } } - // TODO: re-enable when settings are ready - // 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); - // } - // } + public static void testAvoidDuplicateTags() { + final String oldMessage = Settings.getCacheTwitterMessage(); + try { + Settings.setCacheTwitterMessage("[NAME] #cgeo"); + Geocache cache = new Geocache(); + cache.setGeocode("GC1234"); + cache.setName("TwitterTest"); + assertEquals("TwitterTest #cgeo #geocaching", Twitter.getStatusMessage(cache)); + } finally { + Settings.setCacheTwitterMessage(oldMessage); + } + } } |
