Browse Source

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
tags/REL_5_2_4
Dominik Stadler 1 year ago
parent
commit
56d47448ce

+ 1
- 1
poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFPictureData.java 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;

+ 4
- 1
poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java 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());
}
}


+ 6
- 2
poi/src/test/java/org/apache/poi/hssf/model/TestRVA.java 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 {

+ 3
- 1
poi/src/test/java/org/apache/poi/hssf/usermodel/TestMatrixFormulasFromBinarySpreadsheet.java 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 */

+ 3
- 1
poi/src/test/java/org/apache/poi/ss/formula/eval/TestFormulasFromSpreadsheet.java 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() {

Loading…
Cancel
Save