Skip to content

Commit

Permalink
#14 improve description for multiple regions
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyweston committed Oct 29, 2019
1 parent e6aae6e commit 6294ad0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void describeTo(Description description) {
}

private String mergedRegion(Sheet sheet) {
return sheet.getMergedRegions().stream().map(CellRangeAddress::formatAsString).collect(Collectors.joining());
return sheet.getMergedRegions().stream().map(CellRangeAddress::formatAsString).collect(Collectors.joining(", "));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@
public class MergedRegionsMatcherTest {

private Sheet sheetWithMergedRegions;
private Sheet sheetWithMergedRegionsAltText;
private Sheet sheetWithAltMergedRegion;
private Sheet sheetWithTwoMergedRegion;
private Sheet sheetWithMergedRegionsAltText;

@Before
public void loadWorkbookAndSheets() throws IOException {
sheetWithMergedRegions = firstSheetOf("mergedRegionSheet.xlsx");
sheetWithAltMergedRegion = firstSheetOf("mergedRegionWithAltRegion.xlsx");
sheetWithTwoMergedRegion = firstSheetOf("mergedRegionWithTwoRegions.xlsx");
sheetWithMergedRegionsAltText = firstSheetOf("mergedRegionWithAltText.xlsx");
}

Expand Down Expand Up @@ -77,6 +79,13 @@ public void descriptionAltRegion() {
assertThat(description.toString(), is("\"A2:E2\" as a merged region(s) in sheet \"Sheet1\""));
}

@Test
public void descriptionMultipleMismatches() {
Description description = new StringDescription();
hasSameMergedRegions(sheetWithTwoMergedRegion).describeTo(description);
assertThat(description.toString(), is("\"A2:E2, A4:E4\" as a merged region(s) in sheet \"Sheet1\""));
}

@Test
public void mismatch() {
Description description = new StringDescription();
Expand Down

0 comments on commit 6294ad0

Please sign in to comment.