Skip to content

Commit

Permalink
#14 removed getWorkbookFromFactory and replaced in the test with getW…
Browse files Browse the repository at this point in the history
…orkbook as they seem equivalent (with the simple-excel version offering a little more around exception handling)
  • Loading branch information
tobyweston committed Oct 28, 2019
1 parent f33568c commit c70fd3c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
7 changes: 0 additions & 7 deletions src/test/java/bad/robot/excel/WorkbookResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@

import bad.robot.excel.sheet.Coordinate;
import bad.robot.excel.workbook.PoiWorkbookReader;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -34,11 +32,6 @@ public static Workbook getWorkbook(String file) throws IOException {
return new PoiWorkbookReader().read(stream);
}

public static Workbook getWorkbookFromFactory(String file) throws IOException, InvalidFormatException {
InputStream stream = WorkbookResource.class.getResourceAsStream(file);
return WorkbookFactory.create(stream);
}

public static Sheet firstSheetOf(String file) throws IOException {
return getWorkbook(file).getSheetAt(0);
}
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/bad/robot/excel/workbook/PoiWorkbookTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import static bad.robot.excel.DateUtil.createDate;
import static bad.robot.excel.WorkbookResource.getCellForCoordinate;
import static bad.robot.excel.WorkbookResource.getWorkbook;
import static bad.robot.excel.WorkbookResource.getWorkbookFromFactory;
import static bad.robot.excel.column.ColumnIndex.column;
import static bad.robot.excel.column.ExcelColumnIndex.*;
import static bad.robot.excel.matchers.CellType.adaptPoi;
Expand Down Expand Up @@ -164,6 +163,6 @@ public void shouldCountMergedCellsCorrectly() throws IOException, InvalidFormatE
sheet.addMergedRegion(new CellRangeAddress(0, 0, firstMergedCol, lastMergedCol));

// Compare the workbook to an empty workbook without merged cells.
assertThat(workbook, sameWorkbook(getWorkbookFromFactory("emptySheet.xlsx")));
assertThat(workbook, sameWorkbook(getWorkbook("emptySheet.xlsx")));
}
}

0 comments on commit c70fd3c

Please sign in to comment.