This is an automated email from the ASF dual-hosted git repository. centic pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/poi.git
commit cd2229397549611d494042c11ae60305413b72e8 Author: Dominik Stadler <[email protected]> AuthorDate: Sun Nov 16 12:30:39 2025 +0100 Newer Mockito prevents using code from org.mockito.internal.matchers At least locally tests fail now for me, so let's get rid of using internal code here. --- .../org/apache/poi/hwpf/model/TestDocumentProperties.java | 6 ++++-- .../org/apache/poi/hwpf/model/TestFileInformationBlock.java | 10 ++++++---- poi/src/test/java/org/apache/poi/POITestCase.java | 13 ------------- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestDocumentProperties.java b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestDocumentProperties.java index 0a33bab46a..716161b7c1 100644 --- a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestDocumentProperties.java +++ b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestDocumentProperties.java @@ -17,7 +17,7 @@ package org.apache.poi.hwpf.model; -import static org.apache.poi.POITestCase.assertReflectEquals; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; import org.apache.poi.hwpf.HWPFDocFixture; import org.apache.poi.hwpf.model.types.DOPAbstractType; @@ -53,6 +53,8 @@ public final class TestDocumentProperties { _documentProperties.serialize(buf, 0); DocumentProperties newDocProperties = new DocumentProperties(buf, 0, size); - assertReflectEquals(_documentProperties, newDocProperties); + byte[] newBuf = new byte[size]; + newDocProperties.serialize(newBuf, 0); + assertArrayEquals(buf, newBuf); } } diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestFileInformationBlock.java b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestFileInformationBlock.java index b35a8d3c01..dc4899a362 100644 --- a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestFileInformationBlock.java +++ b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestFileInformationBlock.java @@ -17,7 +17,7 @@ package org.apache.poi.hwpf.model; -import static org.apache.poi.POITestCase.assertReflectEquals; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import org.apache.poi.hwpf.HWPFDocFixture; @@ -39,20 +39,22 @@ public final class TestFileInformationBlock { FileInformationBlock newFileInformationBlock = new FileInformationBlock(buf); FibBase actual = newFileInformationBlock.getFibBase(); - assertReflectEquals(expected, actual); + byte[] newBuf = new byte[size]; + actual.serialize(newBuf, 0); + assertArrayEquals(buf, newBuf); assertNotNull(_fileInformationBlock.toString()); } @BeforeEach void setUp() throws Exception { - /** @todo verify the constructors */ + // @todo verify the constructors _hWPFDocFixture = new HWPFDocFixture(this, HWPFDocFixture.DEFAULT_TEST_FILE); _hWPFDocFixture.setUp(); _fileInformationBlock = _hWPFDocFixture._fib; } @AfterEach - void tearDown() throws Exception { + void tearDown() { _fileInformationBlock = null; _hWPFDocFixture.tearDown(); _hWPFDocFixture = null; diff --git a/poi/src/test/java/org/apache/poi/POITestCase.java b/poi/src/test/java/org/apache/poi/POITestCase.java index d4c99bebdb..429ec65705 100644 --- a/poi/src/test/java/org/apache/poi/POITestCase.java +++ b/poi/src/test/java/org/apache/poi/POITestCase.java @@ -39,7 +39,6 @@ import javax.imageio.ImageIO; import org.apache.poi.util.Internal; import org.apache.poi.util.SuppressForbidden; -import org.mockito.internal.matchers.apachecommons.ReflectionEquals; /** * Util class for POI JUnit TestCases, which provide additional features @@ -129,18 +128,6 @@ public final class POITestCase { } } - /** - * Utility method to shallow compare all fields of the objects - * Only use this method in test cases!!! - */ - public static void assertReflectEquals(final Object expected, Object actual) { - // as long as ReflectionEquals is provided by Mockito, use it ... otherwise use commons.lang for the tests - - // JaCoCo Code Coverage adds its own field, don't look at this one here - assertTrue(new ReflectionEquals(expected, "$jacocoData").matches(actual)); - } - - /** * Ensures that the temporary directory is defined and exists and * ensures ImageIO uses this directory for cache-files --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
