aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2013-09-14 14:21:22 +0200
committerBananeweizen <bananeweizen@gmx.de>2013-09-14 14:21:34 +0200
commit947792ed914e4309ecb5159e9878ed15ea1125c9 (patch)
treec62689ef2b6ffa7bb1568e9525ed2760e45aec9a /tests
parent3d5d4c46327244244003982f71aa627d1407d5c3 (diff)
downloadcgeo-947792ed914e4309ecb5159e9878ed15ea1125c9.zip
cgeo-947792ed914e4309ecb5159e9878ed15ea1125c9.tar.gz
cgeo-947792ed914e4309ecb5159e9878ed15ea1125c9.tar.bz2
refactoring: StoredList
* try more encapsulation instead of ID comparisons all time
Diffstat (limited to 'tests')
-rw-r--r--tests/src/cgeo/geocaching/list/PseudoListTest.java18
-rw-r--r--tests/src/cgeo/geocaching/list/StoredListTest.java14
2 files changed, 28 insertions, 4 deletions
diff --git a/tests/src/cgeo/geocaching/list/PseudoListTest.java b/tests/src/cgeo/geocaching/list/PseudoListTest.java
new file mode 100644
index 0000000..d120d81
--- /dev/null
+++ b/tests/src/cgeo/geocaching/list/PseudoListTest.java
@@ -0,0 +1,18 @@
+package cgeo.geocaching.list;
+
+import org.apache.commons.lang3.StringUtils;
+
+import junit.framework.TestCase;
+
+public class PseudoListTest extends TestCase {
+
+ public static void testGetTitleAndCount() throws Exception {
+ final String title = PseudoList.ALL_LIST.title;
+ assertTrue("pseudo lists shall not have a number shown in their title", StringUtils.isAlpha(title.substring(1, title.length() - 1)));
+ }
+
+ public static void testIsConcrete() throws Exception {
+ assertFalse("pseudo lists are not concrete lists", PseudoList.ALL_LIST.isConcrete());
+ }
+
+}
diff --git a/tests/src/cgeo/geocaching/list/StoredListTest.java b/tests/src/cgeo/geocaching/list/StoredListTest.java
index ebe0966..985236a 100644
--- a/tests/src/cgeo/geocaching/list/StoredListTest.java
+++ b/tests/src/cgeo/geocaching/list/StoredListTest.java
@@ -1,21 +1,27 @@
package cgeo.geocaching.list;
import cgeo.geocaching.DataStore;
-import cgeo.geocaching.list.StoredList;
import junit.framework.TestCase;
public class StoredListTest extends TestCase {
public static void testStandardListExists() {
- final StoredList list = DataStore.getList(StoredList.STANDARD_LIST_ID);
+ final StoredList list = getStandardList();
assertNotNull(list);
}
+ private static StoredList getStandardList() {
+ return DataStore.getList(StoredList.STANDARD_LIST_ID);
+ }
+
public static void testEquals() {
- final StoredList list1 = DataStore.getList(StoredList.STANDARD_LIST_ID);
- final StoredList list2 = DataStore.getList(StoredList.STANDARD_LIST_ID);
+ final StoredList list1 = getStandardList();
+ final StoredList list2 = getStandardList();
assertEquals(list1, list2);
}
+ public static void testConcrete() {
+ assertTrue(getStandardList().isConcrete());
+ }
}