Adjust tests, comments, JavaDoc, IDE suggestions

Add more output for a flaky test which sometimes fails on very slow hardware

Shutdown in tests gracefully
Otherwise an NPE may "hide" a test-failure

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1905273 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2022-11-13 19:22:13 +00:00
parent a0abaf205a
commit 56d47448ce
5 changed files with 17 additions and 6 deletions

View File

@ -39,7 +39,7 @@ public class XWPFPictureData extends POIXMLDocumentPart {
private static int MAX_IMAGE_SIZE = DEFAULT_MAX_IMAGE_SIZE;
/**
* @param length the max image size allowed for XSSF pictures
* @param length the max image size allowed for XWPF pictures
*/
public static void setMaxImageSize(int length) {
MAX_IMAGE_SIZE = length;

View File

@ -36,6 +36,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDateTime;
import java.util.*;
@ -3312,7 +3313,9 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
}
LOG.atInfo().log(between(start, now()));
assertTrue(between(start, now()).getSeconds() < 25);
assertTrue(between(start, now()).getSeconds() < 25,
"Had start: " + start + ", now: " + now() +
", diff: " + Duration.between(start, now()).getSeconds());
}
}

View File

@ -53,8 +53,12 @@ final class TestRVA {
@AfterAll
public static void closeResource() throws Exception {
workbook.close();
poifs.close();
if (workbook != null) {
workbook.close();
}
if (poifs != null) {
poifs.close();
}
}
public static Stream<Arguments> data() throws Exception {

View File

@ -101,7 +101,9 @@ final class TestMatrixFormulasFromBinarySpreadsheet {
@AfterAll
public static void closeResource() throws Exception {
LocaleUtil.setUserLocale(userLocale);
workbook.close();
if (workbook != null) {
workbook.close();
}
}
/* generating parameter instances */

View File

@ -100,7 +100,9 @@ public final class TestFormulasFromSpreadsheet {
@AfterAll
public static void closeResource() throws Exception {
LocaleUtil.setUserLocale(userLocale);
workbook.close();
if (workbook != null) {
workbook.close();
}
}
public static Stream<Arguments> data() {