@@ -1499,18 +1499,18 @@ void importOptionsGetterTest() {
14991499 @ ParameterizedTest
15001500 @ DisplayName ("Test of the ImportOption property EnforceValidColumnDimensions" )
15011501 @ CsvSource ({
1502- "valid_column_row_dimensions.xlsx, true, false" ,
1503- "invalid_column_width_min.xlsx, true, true" ,
1504- "invalid_column_width_max.xlsx, true, true" ,
1505- "invalid_row_height_min.xlsx, true, false" ,
1506- "invalid_row_height_max.xlsx, true, false" ,
1507- "valid_column_row_dimensions.xlsx, false, false" ,
1508- "invalid_column_width_min.xlsx, false, false" ,
1509- "invalid_column_width_max.xlsx, false, false" ,
1510- "invalid_row_height_min.xlsx, false, false" ,
1511- "invalid_row_height_max.xlsx, false, false"
1502+ "valid_column_row_dimensions.xlsx, true, false, 0 " ,
1503+ "invalid_column_width_min.xlsx, true, true, -1 " ,
1504+ "invalid_column_width_max.xlsx, true, true, 1 " ,
1505+ "invalid_row_height_min.xlsx, true, false, 0 " ,
1506+ "invalid_row_height_max.xlsx, true, false, 0 " ,
1507+ "valid_column_row_dimensions.xlsx, false, false, 0 " ,
1508+ "invalid_column_width_min.xlsx, false, false, 0 " ,
1509+ "invalid_column_width_max.xlsx, false, false, 0 " ,
1510+ "invalid_row_height_min.xlsx, false, false, 0 " ,
1511+ "invalid_row_height_max.xlsx, false, fals, 0" ,
15121512 })
1513- void enforceValidColumnDimensionsTest (String fileName , boolean givenOptionValue , boolean expectedThrow ) throws Exception {
1513+ void enforceValidColumnDimensionsTest (String fileName , boolean givenOptionValue , boolean expectedThrow , int columnFlag ) throws Exception {
15141514 ImportOptions options = new ImportOptions ();
15151515 options .setEnforceValidColumnDimensions (givenOptionValue );
15161516 options .setEnforceValidRowDimensions (false );
@@ -1520,25 +1520,33 @@ void enforceValidColumnDimensionsTest(String fileName, boolean givenOptionValue,
15201520 Assertions .assertThrows (Exception .class , () -> Workbook .load (stream , options ));
15211521 } else {
15221522 Workbook workbook = Workbook .load (stream , options );
1523- Assertions .assertNotNull (workbook );
1523+ if (columnFlag == -1 ){
1524+ Assertions .assertEquals (Worksheet .MIN_COLUMN_WIDTH , workbook .getWorksheet (0 ).getColumns ().get (0 ).getWidth ());
1525+ }
1526+ else if (columnFlag == 1 ){
1527+ Assertions .assertEquals (Worksheet .MAX_COLUMN_WIDTH , workbook .getWorksheet (0 ).getColumns ().get (0 ).getWidth ());
1528+ }
1529+ else {
1530+ Assertions .assertTrue (true );
1531+ }
15241532 }
15251533 }
15261534
15271535 @ ParameterizedTest
15281536 @ DisplayName ("Test of the ImportOption property EnforceValidRowDimensions" )
15291537 @ CsvSource ({
1530- "valid_column_row_dimensions.xlsx, true, false" ,
1531- "invalid_row_height_min.xlsx, true, true" ,
1532- "invalid_row_height_max.xlsx, true, true" ,
1533- "invalid_column_width_min.xlsx, true, false" ,
1534- "invalid_column_width_max.xlsx, true, false" ,
1535- "valid_column_row_dimensions.xlsx, false, false" ,
1536- "invalid_row_height_min.xlsx, false, false" ,
1537- "invalid_row_height_max.xlsx, false, false" ,
1538- "invalid_column_width_min.xlsx, false, false" ,
1539- "invalid_column_width_max.xlsx, false, false"
1538+ "valid_column_row_dimensions.xlsx, true, false, 0 " ,
1539+ "invalid_row_height_min.xlsx, true, true, -1 " ,
1540+ "invalid_row_height_max.xlsx, true, true, 1 " ,
1541+ "invalid_column_width_min.xlsx, true, false, 0 " ,
1542+ "invalid_column_width_max.xlsx, true, false, 0 " ,
1543+ "valid_column_row_dimensions.xlsx, false, false, 0 " ,
1544+ "invalid_row_height_min.xlsx, false, false, 0 " ,
1545+ "invalid_row_height_max.xlsx, false, false, 0 " ,
1546+ "invalid_column_width_min.xlsx, false, false, 0 " ,
1547+ "invalid_column_width_max.xlsx, false, false, 0 "
15401548 })
1541- void enforceValidRowDimensionsTest (String fileName , boolean givenOptionValue , boolean expectedThrow ) throws Exception {
1549+ void enforceValidRowDimensionsTest (String fileName , boolean givenOptionValue , boolean expectedThrow , int rowFlag ) throws Exception {
15421550 ImportOptions options = new ImportOptions ();
15431551 options .setEnforceValidRowDimensions (givenOptionValue );
15441552 options .setEnforceValidColumnDimensions (false );
@@ -1548,16 +1556,18 @@ void enforceValidRowDimensionsTest(String fileName, boolean givenOptionValue, bo
15481556 Assertions .assertThrows (Exception .class , () -> Workbook .load (stream , options ));
15491557 } else {
15501558 Workbook workbook = Workbook .load (stream , options );
1551- Assertions .assertNotNull (workbook );
1559+ if (rowFlag == -1 ){
1560+ Assertions .assertEquals (Worksheet .MIN_ROW_HEIGHT , workbook .getWorksheet (0 ).getRowHeights ().get (0 ));
1561+ }
1562+ else if (rowFlag == 1 ){
1563+ Assertions .assertEquals (Worksheet .MAX_ROW_HEIGHT , workbook .getWorksheet (0 ).getRowHeights ().get (0 ));
1564+ }
1565+ else {
1566+ Assertions .assertTrue (true );
1567+ }
15521568 }
15531569 }
15541570
1555-
1556- private static <T , D > void assertValues (Map <String , T > givenCells , ImportOptions importOptions , BiConsumer <Object , Object > assertionAction )
1557- throws Exception {
1558- assertValues (givenCells , importOptions , assertionAction , null );
1559- }
1560-
15611571 private static <T , D > void assertValues (Map <String , T > givenCells , ImportOptions importOptions , BiConsumer <Object , Object > assertionAction , Map <String , D > expectedCells )
15621572 throws Exception {
15631573 Workbook workbook = new Workbook ("worksheet1" );
0 commit comments