aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/utils/LeastRecentlyUsedMapTest.java
diff options
context:
space:
mode:
authorMichael Keppler <michael.keppler@gmx.de>2014-04-22 17:30:51 +0200
committerMichael Keppler <michael.keppler@gmx.de>2014-04-22 21:44:00 +0200
commitcc9aa8b1d2b9ec24f2c41e4a523c69edcf8c8ac0 (patch)
treefca2712f72bb2759ef4e39c0235a8a5054f27013 /tests/src/cgeo/geocaching/utils/LeastRecentlyUsedMapTest.java
parent825b779844b280ba7c1effdd4185cc856eccdf5b (diff)
downloadcgeo-cc9aa8b1d2b9ec24f2c41e4a523c69edcf8c8ac0.zip
cgeo-cc9aa8b1d2b9ec24f2c41e4a523c69edcf8c8ac0.tar.gz
cgeo-cc9aa8b1d2b9ec24f2c41e4a523c69edcf8c8ac0.tar.bz2
#2414 convert junit statements to assertj
This conversion is not complete, but the remaining statements are hard to catch with regular expressions automatically.
Diffstat (limited to 'tests/src/cgeo/geocaching/utils/LeastRecentlyUsedMapTest.java')
-rw-r--r--tests/src/cgeo/geocaching/utils/LeastRecentlyUsedMapTest.java42
1 files changed, 22 insertions, 20 deletions
diff --git a/tests/src/cgeo/geocaching/utils/LeastRecentlyUsedMapTest.java b/tests/src/cgeo/geocaching/utils/LeastRecentlyUsedMapTest.java
index 11088e2..c3f563c 100644
--- a/tests/src/cgeo/geocaching/utils/LeastRecentlyUsedMapTest.java
+++ b/tests/src/cgeo/geocaching/utils/LeastRecentlyUsedMapTest.java
@@ -1,5 +1,7 @@
package cgeo.geocaching.utils;
+import static org.assertj.core.api.Assertions.assertThat;
+
import cgeo.geocaching.Geocache;
import java.util.Map;
@@ -47,39 +49,39 @@ public class LeastRecentlyUsedMapTest extends AbstractLRUTest {
public static void testRemoveEldestEntry() {
final LeastRecentlyUsedMap<String, Geocache> cache = new LeastRecentlyUsedMap.LruCache<String, Geocache>(10);
final Geocache first = new Geocache();
- assertNull(cache.put("1", first));
+ assertThat(cache.put("1", first)).isNull();
final Geocache second = new Geocache();
- assertNull(cache.put("2", second));
+ assertThat(cache.put("2", second)).isNull();
- assertEquals(2, cache.size());
- assertTrue(cache.containsKey("1"));
- assertTrue(cache.containsValue(first));
- assertTrue(cache.containsKey("2"));
- assertTrue(cache.containsValue(second));
+ assertThat(cache).hasSize(2);
+ assertThat(cache.containsKey("1")).isTrue();
+ assertThat(cache.containsValue(first)).isTrue();
+ assertThat(cache.containsKey("2")).isTrue();
+ assertThat(cache.containsValue(second)).isTrue();
for (int i = 3; i <= 10; i++) {
- assertNull(cache.put(Integer.toString(i), new Geocache()));
+ assertThat(cache.put(Integer.toString(i), new Geocache())).isNull();
}
- assertEquals(10, cache.size());
- assertTrue(cache.containsKey("1"));
- assertTrue(cache.containsValue(first));
- assertTrue(cache.containsKey("2"));
- assertTrue(cache.containsValue(second));
+ assertThat(cache).hasSize(10);
+ assertThat(cache.containsKey("1")).isTrue();
+ assertThat(cache.containsValue(first)).isTrue();
+ assertThat(cache.containsKey("2")).isTrue();
+ assertThat(cache.containsValue(second)).isTrue();
- assertNotNull(cache.remove("1")); // just replacing the old entry would not work
- assertNull(cache.put("1", new Geocache()));
- assertNull(cache.put("11", new Geocache()));
+ assertThat(cache.remove("1")).isNotNull(); // just replacing the old entry would not work
+ assertThat(cache.put("1", new Geocache())).isNull();
+ assertThat(cache.put("11", new Geocache())).isNull();
- assertEquals(10, cache.size());
+ assertThat(cache).hasSize(10);
// first has been overwritten by new value, but key must be in, because it is very new
- assertTrue(cache.containsKey("1"));
+ assertThat(cache.containsKey("1")).isTrue();
// second has been overwritten by 11
- assertFalse(cache.containsKey("2"));
- assertTrue(cache.containsKey("11"));
+ assertThat(cache.containsKey("2")).isFalse();
+ assertThat(cache.containsKey("11")).isTrue();
}
}