aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/POITestCase.java
diff options
context:
space:
mode:
authorJaven O'Neal <onealj@apache.org>2017-04-15 03:19:27 +0000
committerJaven O'Neal <onealj@apache.org>2017-04-15 03:19:27 +0000
commit7f79ea46443e1ccc5c3a3c32eb27e6f94a7cd053 (patch)
tree92c59e0a88025eb868d3c3bca3049d1d92eb34f2 /src/testcases/org/apache/poi/POITestCase.java
parentdde4fabc8ca91b33089515df983d29f63a2e5c28 (diff)
downloadpoi-7f79ea46443e1ccc5c3a3c32eb27e6f94a7cd053.tar.gz
poi-7f79ea46443e1ccc5c3a3c32eb27e6f94a7cd053.zip
change from hamcrest-core-1.3 to hamcrest-all-1.3
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1791444 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/POITestCase.java')
-rw-r--r--src/testcases/org/apache/poi/POITestCase.java28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/testcases/org/apache/poi/POITestCase.java b/src/testcases/org/apache/poi/POITestCase.java
index 6dec448f2f..4545a4d0c3 100644
--- a/src/testcases/org/apache/poi/POITestCase.java
+++ b/src/testcases/org/apache/poi/POITestCase.java
@@ -30,6 +30,10 @@ import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.hamcrest.CoreMatchers.endsWith;
import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.Matchers.lessThan;
+import static org.hamcrest.Matchers.lessThanOrEqualTo;
+import static org.hamcrest.Matchers.greaterThan;
+import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Field;
@@ -57,6 +61,12 @@ public final class POITestCase {
assertThat(string, startsWith(prefix));
}
+ public static void assertStartsWith(String message, String string, String prefix) {
+ assertNotNull(message, string);
+ assertNotNull(message, prefix);
+ assertThat(message, string, startsWith(prefix));
+ }
+
public static void assertEndsWith(String string, String suffix) {
assertNotNull(string);
assertNotNull(suffix);
@@ -69,6 +79,12 @@ public final class POITestCase {
assertThat(haystack, containsString(needle));
}
+ public static void assertContains(String message, String haystack, String needle) {
+ assertNotNull(message, haystack);
+ assertNotNull(message, needle);
+ assertThat(message, haystack, containsString(needle));
+ }
+
public static void assertContainsIgnoreCase(String haystack, String needle, Locale locale) {
assertNotNull(haystack);
assertNotNull(needle);
@@ -250,15 +266,11 @@ public final class POITestCase {
}
public static void assertBetween(String message, int value, int min, int max) {
- assertTrue(message + ": " + value + " is less than the minimum value of " + min,
- min <= value);
- assertTrue(message + ": " + value + " is greater than the maximum value of " + max,
- value <= max);
+ assertThat(message, value, greaterThanOrEqualTo(min));
+ assertThat(message, value, lessThanOrEqualTo(max));
}
public static void assertStrictlyBetween(String message, int value, int min, int max) {
- assertTrue(message + ": " + value + " is less than or equal to the minimum value of " + min,
- min < value);
- assertTrue(message + ": " + value + " is greater than or equal to the maximum value of " + max,
- value < max);
+ assertThat(message, value, greaterThan(min));
+ assertThat(message, value, lessThan(max));
}
}