samuelwillyanto1 commented on code in PR #8911:
URL: https://github.com/apache/hop/pull/8911#discussion_r4278571595
##########
plugins/actions/columnsexist/src/test/java/org/apache/hop/workflow/actions/columnsexist/ActionColumnsExistTest.java:
##########
@@ -47,4 +66,86 @@ void testSerialization() throws Exception {
Assertions.assertEquals("F1", action.getColumns().get(0).getName());
Assertions.assertEquals("F2", action.getColumns().get(1).getName());
}
+
+ @Test
+ void testExecuteWithNoConnection() {
+ ActionColumnsExist action = new ActionColumnsExist();
+ action.setConnectionName(null);
Review Comment:
Thanks for the thorough review and catching that edge case, @mattcasters.
Updated accordingly:
1. In `testExecuteWithNoConnection` and
`testExecuteWithNonExistentConnection`, set a non-empty table name and column
list so execution passes table-name validation and tests the connection guard
directly (accurately reproducing #8904).
2. Added `getDatabase(DatabaseMeta)` factory method in `ActionColumnsExist`
to allow stubbing the `Database` instance in unit tests.
3. Added `testExecuteSuccess` which stubs `checkTableExists` and
`checkColumnExists` to return `true`, asserting `result=true` and `nrErrors=0`.
4. Added additional tests for table-not-found and missing-column scenarios
(`testExecuteTableNotExists` and `testExecuteColumnNotExists`).
5. Rebased on latest `main`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]