Skip to content

Commit 555b2ae

Browse files
committed
add CsvReportPage test
1 parent 14dccb0 commit 555b2ae

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/test/java/org/spacious_team/table_wrapper/csv/CsvReportPageTest.java

+18
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,30 @@
2929
import java.io.IOException;
3030
import java.io.InputStream;
3131
import java.nio.charset.Charset;
32+
import java.nio.file.Files;
33+
import java.nio.file.Path;
3234

3335
import static org.junit.jupiter.api.Assertions.assertEquals;
3436
import static org.junit.jupiter.api.Assertions.assertNull;
3537

3638
class CsvReportPageTest {
3739

40+
@Test
41+
@SuppressWarnings("ConstantConditions")
42+
void createFromFile() throws IOException {
43+
Path path = Files.createTempFile("table-wrapper-csv-impl-test.csv", "csv");
44+
try {
45+
Files.writeString(path, "0,1");
46+
CsvReportPage reportPage = new CsvReportPage(path);
47+
48+
@Nullable CsvTableRow row = reportPage.getRow(0);
49+
assertEquals("0", row.getCell(0).getValue());
50+
assertEquals("1", row.getCell(1).getValue());
51+
} finally {
52+
Files.delete(path);
53+
}
54+
}
55+
3856
@ParameterizedTest
3957
@ValueSource(strings = {"UTF-8", "Windows-1251"})
4058
void testInputDataCharset(String charsetName) throws IOException {

0 commit comments

Comments
 (0)