aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/utils/MiscUtilsTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/cgeo/geocaching/utils/MiscUtilsTest.java')
-rw-r--r--tests/src/cgeo/geocaching/utils/MiscUtilsTest.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/src/cgeo/geocaching/utils/MiscUtilsTest.java b/tests/src/cgeo/geocaching/utils/MiscUtilsTest.java
index 2ee99c4..2e170d2 100644
--- a/tests/src/cgeo/geocaching/utils/MiscUtilsTest.java
+++ b/tests/src/cgeo/geocaching/utils/MiscUtilsTest.java
@@ -1,14 +1,17 @@
package cgeo.geocaching.utils;
-import junit.framework.TestCase;
+import static org.assertj.core.api.Assertions.assertThat;
import java.util.LinkedList;
import java.util.List;
+import junit.framework.TestCase;
+
public class MiscUtilsTest extends TestCase {
public static void testBufferEmpty() {
- for (final List<String> s: MiscUtils.buffer(new LinkedList<String>(), 10)) {
+ for (final List<String> s : MiscUtils.buffer(new LinkedList<String>(), 10)) {
+ assertThat(s).isNotNull(); // only to silence findbugs and the compiler
fail("empty collection should not iterate");
}
}
@@ -20,11 +23,11 @@ public class MiscUtilsTest extends TestCase {
}
int count = 0;
for (final List<Integer> subList: MiscUtils.buffer(list, 10)) {
- assertEquals("each sublist has the right size", 10, subList.size());
- assertEquals("sublist has the right content", count * 10, (int) subList.get(0));
+ assertThat(subList).hasSize(10);
+ assertThat(subList.get(0)).as("sublist content").isEqualTo(count * 10);
count++;
}
- assertEquals("there are the right number of sublists", 5, count);
+ assertThat(count).isEqualTo(5);
}
public static void testNonMultiple() {
@@ -34,7 +37,7 @@ public class MiscUtilsTest extends TestCase {
}
int count = 0;
for (final List<Integer> subList: MiscUtils.buffer(list, 10)) {
- assertTrue("each sublist has no more than the allowed number of arguments", subList.size() <= 10);
+ assertThat(subList.size()).overridingErrorMessage("each sublist has no more than the allowed number of arguments").isLessThanOrEqualTo(10);
count += subList.size();
}
assertEquals("all the elements were seen", 48, count);