mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
[bug-69646] add tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1924986 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6cbc6694ab
commit
8bf71069cd
@ -460,7 +460,7 @@ public class SheetDataWriter implements Closeable {
|
||||
try {
|
||||
_out.close();
|
||||
} finally {
|
||||
ret = _fd != null && _fd.delete();
|
||||
ret = _fd == null || _fd.delete();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.poi.util.IOUtils;
|
||||
@ -69,6 +70,7 @@ public final class TestSheetDataWriter {
|
||||
IOUtils.closeQuietly(writer);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testWriteNewLines() throws IOException {
|
||||
SheetDataWriter writer = new SheetDataWriter();
|
||||
@ -84,4 +86,17 @@ public final class TestSheetDataWriter {
|
||||
IOUtils.closeQuietly(writer);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDispose() throws IOException {
|
||||
SheetDataWriter writer = new SheetDataWriter();
|
||||
assertTrue(writer.dispose());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testWriterDispose() throws IOException {
|
||||
StringWriter sw = new StringWriter();
|
||||
SheetDataWriter writer = new SheetDataWriter(sw);
|
||||
assertTrue(writer.dispose());
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user