aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/LazyInitialilzedListTest.java
diff options
context:
space:
mode:
authorMichael Keppler <michael.keppler@gmx.de>2014-04-23 11:04:48 +0200
committerMichael Keppler <michael.keppler@gmx.de>2014-04-23 11:04:48 +0200
commit9a9c9560e7259b85a8076ed9230c5df0b6bbb0ba (patch)
treed54e64202e6682017afc172fe6d8210294c2885d /tests/src/cgeo/geocaching/LazyInitialilzedListTest.java
parent97b047e525aaab3df7e5f6b2481f3109f193516e (diff)
downloadcgeo-9a9c9560e7259b85a8076ed9230c5df0b6bbb0ba.zip
cgeo-9a9c9560e7259b85a8076ed9230c5df0b6bbb0ba.tar.gz
cgeo-9a9c9560e7259b85a8076ed9230c5df0b6bbb0ba.tar.bz2
rename test class
Diffstat (limited to 'tests/src/cgeo/geocaching/LazyInitialilzedListTest.java')
-rw-r--r--tests/src/cgeo/geocaching/LazyInitialilzedListTest.java76
1 files changed, 0 insertions, 76 deletions
diff --git a/tests/src/cgeo/geocaching/LazyInitialilzedListTest.java b/tests/src/cgeo/geocaching/LazyInitialilzedListTest.java
deleted file mode 100644
index ec1f593..0000000
--- a/tests/src/cgeo/geocaching/LazyInitialilzedListTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package cgeo.geocaching;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import cgeo.geocaching.utils.LazyInitializedList;
-
-import android.test.AndroidTestCase;
-
-import java.util.LinkedList;
-import java.util.List;
-
-public class LazyInitialilzedListTest extends AndroidTestCase {
-
- private static final int MAKE_NULL = -1;
- private static final int MAKE_EXCEPTION = -2;
-
- private static class MyList extends LazyInitializedList<Integer> {
-
- private int counter;
-
- MyList(int counter) {
- this.counter = counter;
- }
-
- @Override
- public List<Integer> call() {
- if (counter == MAKE_NULL) {
- return null;
- }
- if (counter == MAKE_EXCEPTION) {
- throw new RuntimeException("exception in call()");
- }
- final List<Integer> result = new LinkedList<Integer>();
- for (int i = 0; i < counter; i++) {
- result.add(counter);
- }
- counter += 1;
- return result;
- }
-
- int getCounter() {
- return counter;
- }
-
- }
-
- public static void testCallOnce() {
- final MyList list = new MyList(0);
- assertThat(list.getCounter()).overridingErrorMessage("call() must not be called prematurely").isEqualTo(0);
- list.size();
- assertThat(list.getCounter()).overridingErrorMessage("call() must be called when needed").isEqualTo(1);
- list.size();
- assertThat(list.getCounter()).overridingErrorMessage("call() must be called only once").isEqualTo(1);
- }
-
- public static void testSize() {
- final MyList list = new MyList(3);
- assertThat(list).overridingErrorMessage("completed size must be identical to call() result").hasSize(3);
- }
-
- public static void testValue() {
- final MyList list = new MyList(1);
- assertThat(list.get(0)).overridingErrorMessage("value must be identical to call() result").isEqualTo(1);
- }
-
- public static void testNull() {
- final MyList list = new MyList(MAKE_NULL);
- assertThat(list).overridingErrorMessage("null returned by call() must create an empty list").isEmpty();
- }
-
- public static void testException() {
- final MyList list = new MyList(MAKE_EXCEPTION);
- assertThat(list).overridingErrorMessage("exception in call() must create an empty list").isEmpty();
- }
-
-}