mirror of
https://github.com/apache/poi.git
synced 2026-02-27 12:30:08 +08:00
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.
This commit is contained in:
parent
d486e50822
commit
cd22293975
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user