Skip to content

Commit e284cee

Browse files
committed
Added General Usage Extractions to the README
1 parent b5b3c9a commit e284cee

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

README.md

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Excel-Comparision Framework which is able to create a human readable diff when comparing Excel Files.
1+
Excel-Comparision Framework which is able to create a human readable diff when comparing Excel Files. The Values are extracted using the `org.apache.poi` Framework
22

33
## Integration
44

@@ -15,20 +15,22 @@ dependencies {
1515
### Maven
1616
```
1717
<repositories>
18-
<repository>
19-
<id>jcenter</id>
20-
<url>https://jcenter.bintray.com/</url>
21-
</repository>
18+
<repository>
19+
<id>jcenter</id>
20+
<url>https://jcenter.bintray.com/</url>
21+
</repository>
2222
</repositories>
2323
...
2424
<dependency>
25-
<groupId>de.sijakubo</groupId>
26-
<artifactId>excel-comparison</artifactId>
27-
<version>0.1.1</version>
25+
<groupId>de.sijakubo</groupId>
26+
<artifactId>excel-comparison</artifactId>
27+
<version>0.1.1</version>
2828
</dependency>
2929
```
3030

31-
## General Usage
31+
## General Usage Assertions
32+
33+
To compare workbook / sheet content you can use the `ExcelAssert.java`. This provides methods to either compare Files or `org.apache.poi.ss.usermodel.Workbook`
3234

3335
### JUnit
3436
```java
@@ -59,3 +61,23 @@ public class ExcelComparisonTest {
5961
ExcelAssert.assertWorkbookEquals(actualWorkbook, expectedWorkbook)
6062
}
6163
```
64+
65+
## General Usage Extractions
66+
67+
In order to compare the Content of an Excel file, i needed to extract the information to `basic` Java Types.
68+
You can also use that to compare Excel Content as you like using the `ExcelExtractor.java`
69+
70+
### Spock
71+
```groovy
72+
//using spock
73+
def "should extract sheet containing formula"() {
74+
given:
75+
def testExcelFile = new File(this.getClass().getResource("formula_sample.xlsx").getFile())
76+
77+
when:
78+
List<Map<String, Object>> formularSheetValues = ExcelExtractor.extractSheetValues(testExcelFile, 0)
79+
80+
then:
81+
snapshot(formularSheetValues, JSON) == current(formularSheetValues, JSON)
82+
}
83+
```

0 commit comments

Comments
 (0)