Skip to content

Commit 2615d7d

Browse files
committed
Issue #109. Added a new field to the Callable object to now track all the crud operations and queries that occur in it as an array list. Also updated the test case to capture this.
Signed-off-by: Rahul Krishna <i.m.ralk@gmail.com>
1 parent 2907fec commit 2615d7d

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

src/test/java/com/ibm/cldk/CodeAnalyzerIntegrationTest.java

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,20 +178,29 @@ void shouldBeAbleToDetectCRUDOperationsAndQueriesForPlantByWebsphere() throws Ex
178178
String expectedCrudOperation =
179179
"\"crud_operations\": [" +
180180
"{" +
181-
"\"line_number\": 115," +
182-
"\"operation_type\": \"READ\"," +
183-
"\"target_table\": null," +
184-
"\"involved_fields\": null," +
185-
"\"condition\": null," +
186-
"\"joined_tables\": null," +
187-
"\"technology\": null," +
188-
"\"is_batch_operation\": false" +
181+
"\"line_number\": 115," +
182+
"\"operation_type\": \"READ\"," +
183+
"\"target_table\": null," +
184+
"\"involved_fields\": null," +
185+
"\"condition\": null," +
186+
"\"joined_tables\": null," +
187+
"\"technology\": null," +
188+
"\"is_batch_operation\": false" +
189189
"}]";
190190

191-
// Remove whitespace and newlines for a more robust comparison
191+
// Expected JSON for CRUD Queries
192+
String expectedCrudQuery =
193+
"\"crud_queries\": [" +
194+
"{" +
195+
"\"line_number\": 141,";
196+
197+
// Normalize the output and expected strings to ignore formatting differences
192198
String normalizedOutput = output.replaceAll("\\s+", "");
193199
String normalizedExpectedCrudOperation = expectedCrudOperation.replaceAll("\\s+", "");
200+
String normalizedExpectedCrudQuery = expectedCrudQuery.replaceAll("\\s+", "");
194201

202+
// Assertions for both CRUD operations and queries
195203
Assertions.assertTrue(normalizedOutput.contains(normalizedExpectedCrudOperation), "Expected CRUD operation JSON structure not found");
204+
Assertions.assertTrue(normalizedOutput.contains(normalizedExpectedCrudQuery), "Expected CRUD query JSON structure not found");
196205
}
197206
}

0 commit comments

Comments
 (0)