Skip to content

Commit 78f56a0

Browse files
coverage without jooq
1 parent d0f71a3 commit 78f56a0

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

dbAndCsvBatch/build.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,17 @@ jacocoTestReport {
6666
csv.required = true
6767
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
6868
}
69+
70+
// Exclude packages or classes from the coverage report
71+
afterEvaluate {
72+
classDirectories.setFrom(
73+
files(classDirectories.files.collect {
74+
fileTree(dir: it, exclude: [
75+
'com/example/batch/jooq/**'
76+
])
77+
})
78+
)
79+
}
6980
}
7081

7182
// https://github.com/diffplug/spotless

dbAndCsvBatch/src/test/java/com/example/batch/repository/MemberRepositoryTest.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,32 @@ void testDelete() {
8181
assertTrue(selected.isEmpty(), "Expected no records after deletion.");
8282
}
8383

84+
@Test
85+
void testBulkInsert() {
86+
// Prepare test data
87+
List<MemberRecord> members =
88+
List.of(
89+
createMemberRecord("Test1", "[email protected]", "1234567890", "Address 1", (byte) 100),
90+
createMemberRecord(
91+
"Test2", "[email protected]", "0987654321", "Address 2", (byte) 100));
92+
93+
// Execute bulkInsert
94+
repository.bulkInsert(members);
95+
96+
// Verify inserted data
97+
List<MemberRecord> selected =
98+
repository.selectByTypeAndDeleteFlag(List.of((byte) 100), (byte) 0);
99+
assertEquals(2, selected.size(), "Expected 2 records to be inserted.");
100+
101+
assertEquals("Test1", selected.get(0).getName(), "First record name mismatch.");
102+
assertEquals("Test2", selected.get(1).getName(), "Second record name mismatch.");
103+
assertEquals("[email protected]", selected.get(0).getEmail(), "First record email mismatch.");
104+
assertEquals("[email protected]", selected.get(1).getEmail(), "Second record email mismatch.");
105+
106+
// Clean up inserted records
107+
selected.forEach(record -> repository.delete(record.getId()));
108+
}
109+
84110
private void cleanupRecordsByType(byte type) {
85111
List<MemberRecord> existingRecords =
86112
repository.selectByTypeAndDeleteFlag(List.of(type), (byte) 0);

0 commit comments

Comments
 (0)