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-ffa450edef68tags/REL_5_2_4
@@ -217,6 +217,8 @@ public class XSSFFileHandler extends SpreadsheetHandler { | |||
} | |||
handleExtracting(file); | |||
handleAdditional(file); | |||
} | |||
@Test |
@@ -22,6 +22,7 @@ import org.apache.poi.openxml4j.exceptions.InvalidFormatException; | |||
import org.apache.poi.openxml4j.opc.OPCPackage; | |||
import org.apache.poi.openxml4j.util.ZipSecureFile; | |||
import org.junit.jupiter.api.Test; | |||
import org.junit.jupiter.api.parallel.Isolated; | |||
import java.io.File; | |||
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.fail; | |||
@Isolated // changes static values, so other tests should not run at the same time | |||
class TestOPCPackageFileLimit { | |||
@Test | |||
void testWithReducedFileLimit() throws InvalidFormatException { |
@@ -67,6 +67,12 @@ public final class TestReadOnlySharedStringsTable { | |||
assertEquals(i1.getString(), rtbl.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; | |||
@Override | |||
public void write(int b) throws IOException { | |||
public void write(int b) { | |||
count++; | |||
} | |||
@Override | |||
public void write(byte[] b) throws IOException { | |||
public void write(byte[] b) { | |||
count += b.length; | |||
} | |||
@Override | |||
public void write(byte[] b, int off, int len) throws IOException { | |||
public void write(byte[] b, int off, int len) { | |||
count += len; | |||
} | |||