diff options
Diffstat (limited to 'tests/src/cgeo/geocaching/LazyInitialilzedListTest.java')
| -rw-r--r-- | tests/src/cgeo/geocaching/LazyInitialilzedListTest.java | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/tests/src/cgeo/geocaching/LazyInitialilzedListTest.java b/tests/src/cgeo/geocaching/LazyInitialilzedListTest.java index d129838..ec1f593 100644 --- a/tests/src/cgeo/geocaching/LazyInitialilzedListTest.java +++ b/tests/src/cgeo/geocaching/LazyInitialilzedListTest.java @@ -1,5 +1,7 @@ package cgeo.geocaching; +import static org.assertj.core.api.Assertions.assertThat; + import cgeo.geocaching.utils.LazyInitializedList; import android.test.AndroidTestCase; @@ -43,32 +45,32 @@ public class LazyInitialilzedListTest extends AndroidTestCase { } public static void testCallOnce() { - final MyList l = new MyList(0); - assertEquals("call() must not be called prematurely", 0, l.getCounter()); - l.size(); - assertEquals("call() must be called when needed", 1, l.getCounter()); - l.size(); - assertEquals("call() must be called only once", 1, l.getCounter()); + 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 l = new MyList(3); - assertEquals("completed size must be identical to call() result", 3, l.size()); + 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 l = new MyList(1); - assertEquals("value must be identical to call() result", Integer.valueOf(1), l.get(0)); + 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 l = new MyList(MAKE_NULL); - assertEquals("null returned by call() must create an empty list", 0, l.size()); + 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 l = new MyList(MAKE_EXCEPTION); - assertEquals("exception in call() must create an empty list", 0, l.size()); + final MyList list = new MyList(MAKE_EXCEPTION); + assertThat(list).overridingErrorMessage("exception in call() must create an empty list").isEmpty(); } } |
