diff options
author | Javen O'Neal <onealj@apache.org> | 2017-01-05 12:46:28 +0000 |
---|---|---|
committer | Javen O'Neal <onealj@apache.org> | 2017-01-05 12:46:28 +0000 |
commit | 6d225429902caf4fc3d29ed3d86ae3994355d2d3 (patch) | |
tree | 6698c94104e5731d38cf19e6b11edb8ede339ec3 /src/testcases | |
parent | 0ab2eac70e963e748b1d2a9cc5d1263bd4ead2fb (diff) | |
download | poi-6d225429902caf4fc3d29ed3d86ae3994355d2d3.tar.gz poi-6d225429902caf4fc3d29ed3d86ae3994355d2d3.zip |
add unit tests for MAPIMessage.get*Body()
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1777463 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
-rw-r--r-- | src/testcases/org/apache/poi/POITestCase.java | 8 | ||||
-rw-r--r-- | src/testcases/org/apache/poi/TestPOITestCase.java | 7 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/POITestCase.java b/src/testcases/org/apache/poi/POITestCase.java index a8cc8e1db6..a6cb26a901 100644 --- a/src/testcases/org/apache/poi/POITestCase.java +++ b/src/testcases/org/apache/poi/POITestCase.java @@ -44,6 +44,14 @@ import org.apache.poi.util.Internal; */ @Internal public final class POITestCase { + public static void assertStartsWith(String string, String prefix) { + assertNotNull(string); + assertNotNull(prefix); + + final int len = Math.min(string.length(), prefix.length()); + assertEquals("string does not start with prefix", prefix, string.substring(0, len)); + } + public static void assertContains(String haystack, String needle) { assertNotNull(haystack); assertTrue( diff --git a/src/testcases/org/apache/poi/TestPOITestCase.java b/src/testcases/org/apache/poi/TestPOITestCase.java index fd9f3d1ad9..314009604c 100644 --- a/src/testcases/org/apache/poi/TestPOITestCase.java +++ b/src/testcases/org/apache/poi/TestPOITestCase.java @@ -34,6 +34,13 @@ import org.junit.Test; */ public final class TestPOITestCase { @Test + public void assertStartsWith() { + POITestCase.assertStartsWith("Apache POI", ""); + POITestCase.assertStartsWith("Apache POI", "Apache"); + POITestCase.assertStartsWith("Apache POI", "Apache POI"); + } + + @Test public void assertContains() { POITestCase.assertContains("There is a needle in this haystack", "needle"); /*try { |