mirror of https://github.com/apache/poi.git
Apply some IDE suggestions, add tests, set unit-test to isolated
Without Isolation, one test did change static settings and thus could cause flaky tests git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1911891 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cdb2ba1398
commit
2999073715
|
@ -217,6 +217,8 @@ public class XSSFFileHandler extends SpreadsheetHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleExtracting(file);
|
handleExtracting(file);
|
||||||
|
|
||||||
|
handleAdditional(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||||
import org.apache.poi.openxml4j.util.ZipSecureFile;
|
import org.apache.poi.openxml4j.util.ZipSecureFile;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.parallel.Isolated;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -30,6 +31,7 @@ import java.io.InputStream;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
|
@Isolated // changes static values, so other tests should not run at the same time
|
||||||
class TestOPCPackageFileLimit {
|
class TestOPCPackageFileLimit {
|
||||||
@Test
|
@Test
|
||||||
void testWithReducedFileLimit() throws InvalidFormatException {
|
void testWithReducedFileLimit() throws InvalidFormatException {
|
||||||
|
|
|
@ -67,6 +67,12 @@ public final class TestReadOnlySharedStringsTable {
|
||||||
assertEquals(i1.getString(), rtbl.getItemAt(i).getString());
|
assertEquals(i1.getString(), rtbl.getItemAt(i).getString());
|
||||||
assertEquals(i1.getString(), rtbl2.getItemAt(i).getString());
|
assertEquals(i1.getString(), rtbl2.getItemAt(i).getString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// verify invalid indices
|
||||||
|
assertThrows(IllegalStateException.class,
|
||||||
|
() -> rtbl.getItemAt(stbl.getUniqueCount()));
|
||||||
|
assertThrows(IndexOutOfBoundsException.class,
|
||||||
|
() -> rtbl.getItemAt(-1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1085,17 +1085,17 @@ public final class HSLFSlideShowImpl extends POIDocument implements Closeable {
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(int b) throws IOException {
|
public void write(int b) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(byte[] b) throws IOException {
|
public void write(byte[] b) {
|
||||||
count += b.length;
|
count += b.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(byte[] b, int off, int len) throws IOException {
|
public void write(byte[] b, int off, int len) {
|
||||||
count += len;
|
count += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue