|
3 | 3 | import static org.junit.Assert.*; |
4 | 4 |
|
5 | 5 | import java.io.IOException; |
| 6 | +import java.nio.file.Files; |
| 7 | +import java.nio.file.Path; |
| 8 | +import java.nio.file.FileSystem; |
| 9 | +import java.nio.file.FileSystems; |
6 | 10 |
|
7 | 11 | import org.apache.commons.cli.CommandLine; |
8 | 12 | import org.apache.commons.cli.CommandLineParser; |
@@ -35,6 +39,30 @@ public void testExtractSpreadsheetWithArea() throws ParseException, IOException |
35 | 39 | })); |
36 | 40 | } |
37 | 41 |
|
| 42 | + @Test |
| 43 | + public void testExtractBatchSpreadsheetWithArea() throws ParseException, IOException { |
| 44 | + FileSystem fs = FileSystems.getDefault(); |
| 45 | + String expectedCsv = UtilsForTesting.loadCsv("src/test/resources/technology/tabula/csv/spreadsheet_no_bounding_frame.csv"); |
| 46 | + Path tmpFolder = Files.createTempDirectory("tabula-java-batch-test"); |
| 47 | + tmpFolder.toFile().deleteOnExit(); |
| 48 | + |
| 49 | + Path copiedPDF = tmpFolder.resolve(fs.getPath("spreadsheet.pdf")); |
| 50 | + Path sourcePDF = fs.getPath("src/test/resources/technology/tabula/spreadsheet_no_bounding_frame.pdf"); |
| 51 | + Files.copy(sourcePDF, copiedPDF); |
| 52 | + copiedPDF.toFile().deleteOnExit(); |
| 53 | + |
| 54 | + this.csvFromCommandLineArgs(new String[] { |
| 55 | + "-b", tmpFolder.toString(), |
| 56 | + "-p", "1", "-a", |
| 57 | + "150.56,58.9,654.7,536.12", "-f", |
| 58 | + "CSV" |
| 59 | + }); |
| 60 | + |
| 61 | + Path csvPath = tmpFolder.resolve(fs.getPath("spreadsheet.csv")); |
| 62 | + assertTrue(csvPath.toFile().exists()); |
| 63 | + assertArrayEquals(expectedCsv.getBytes(), Files.readAllBytes(csvPath)); |
| 64 | + } |
| 65 | + |
38 | 66 | @Test |
39 | 67 | public void testExtractSpreadsheetWithAreaAndNewFile() throws ParseException, IOException { |
40 | 68 |
|
|
0 commit comments