improve error message if CellRangeAddress intersection assertion fails

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1711597 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2015-10-31 11:20:15 +00:00
parent 5f23aa95f7
commit 07cf6736ae
1 changed files with 10 additions and 4 deletions

View File

@ -256,11 +256,17 @@ public final class TestCellRangeAddress extends TestCase {
}
private static void assertIntersects(CellRangeAddress regionA, CellRangeAddress regionB) {
assertTrue(regionA.intersects(regionB));
assertTrue(regionB.intersects(regionA));
if (!(regionA.intersects(regionB) && regionB.intersects(regionA))) {
final String A = regionA.formatAsString();
final String B = regionB.formatAsString();
fail("expected: regions "+A+" and "+B+" intersect");
}
}
private static void assertNotIntersects(CellRangeAddress regionA, CellRangeAddress regionB) {
assertFalse(regionA.intersects(regionB));
assertFalse(regionB.intersects(regionA));
if ((regionA.intersects(regionB) || regionB.intersects(regionA))) {
final String A = regionA.formatAsString();
final String B = regionB.formatAsString();
fail("expected: regions "+A+" and "+B+" do not intersect");
}
}
}