From 14736096ec04a8a1e0a0d307f4fa389e57f0833d Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Sat, 31 Oct 2015 11:20:15 +0000 Subject: [PATCH] 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 --- .../apache/poi/ss/util/TestCellRangeAddress.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/testcases/org/apache/poi/ss/util/TestCellRangeAddress.java b/src/testcases/org/apache/poi/ss/util/TestCellRangeAddress.java index 5c35a2dff1..cf9e6019e7 100644 --- a/src/testcases/org/apache/poi/ss/util/TestCellRangeAddress.java +++ b/src/testcases/org/apache/poi/ss/util/TestCellRangeAddress.java @@ -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"); + } } } -- 2.39.5