16
16
17
17
# CSV Comparator
18
18
19
- ## Gradle Project
20
- Add the ` csv-comparator ` dependency to your build.gradle.
19
+ ## How To Use
20
+ ### Gradle Project
21
+ Add the ` csv-comparator ` dependency to your build.gradle
21
22
``` gradle
22
- repositories {
23
- mavenCentral()
24
- }
25
-
26
23
dependencies {
27
- implementation(' com.github.ngoanh2n:csv-comparator:1.2.0' )
24
+ testImplementation(" com.github.ngoanh2n:csv-comparator:1.2.0" )
28
25
}
29
26
```
30
27
31
- ## Maven Project
32
- Add the ` csv-comparator ` dependency to your pom.
28
+ ### Maven Project
29
+ Add the ` csv-comparator ` dependency to your pom
33
30
``` xml
34
31
<dependencies >
35
32
[...]
36
33
<dependency >
37
34
<groupId >com.github.ngoanh2n</groupId >
38
35
<artifactId >csv-comparator</artifactId >
39
36
<version >1.2.0</version >
37
+ <scope >test</scope >
40
38
</dependency >
41
39
[...]
42
40
</dependencies >
43
41
```
44
42
45
- ## How To Use
43
+ ## How To Apply
46
44
Compare 2 CSV files formatted columns:
47
45
```
48
46
id,email,firstname,lastname,age,note
@@ -58,7 +56,7 @@ CsvComparisonSource<File> source = CsvComparisonSource.create(expectedCsv, actua
58
56
CsvComparisonOptions options = CsvComparisonOptions
59
57
.builder()
60
58
.setColumns(1 , 2 , 3 )
61
- .setIdentityColumn(0 ) // position starts with 0 in array [1, 2, 3]
59
+ .setIdentityColumn(0 ) // position starts with 0 in array [1, 2, 3]
62
60
.build();
63
61
```
64
62
@@ -77,13 +75,15 @@ CsvComparisonResult result = new CsvComparator(source, options).compare();
77
75
```
78
76
79
77
### Asssert ` CsvComparisonResult `
80
- - ` #hasDiff() `
81
- - ` #hasDeleted() `
82
- - ` #hasInserted() `
83
- - ` #hasModified() `
84
- - ` #rowsKept() `
85
- - ` #rowsDeleted() `
86
- - ` #rowsInserted() `
87
- - ` #rowsModified() `
78
+ ``` java
79
+ CsvComparisonResult . hasDiff()
80
+ CsvComparisonResult . hasDeleted()
81
+ CsvComparisonResult . hasInserted()
82
+ CsvComparisonResult . hasModified()
83
+ CsvComparisonResult . rowsKept()
84
+ CsvComparisonResult . rowsDeleted()
85
+ CsvComparisonResult . rowsInserted()
86
+ CsvComparisonResult . rowsModified()
87
+ ```
88
88
89
89
_ By default, result files which is created after comparing is located at ` build/comparator/csv/{yyyyMMdd.HHmmss.SSS}/ ` _
0 commit comments