diff --git a/connectors/citrus-sql/src/main/java/org/citrusframework/actions/ExecuteSQLQueryAction.java b/connectors/citrus-sql/src/main/java/org/citrusframework/actions/ExecuteSQLQueryAction.java index 9c71dad35b..2e7a629b22 100644 --- a/connectors/citrus-sql/src/main/java/org/citrusframework/actions/ExecuteSQLQueryAction.java +++ b/connectors/citrus-sql/src/main/java/org/citrusframework/actions/ExecuteSQLQueryAction.java @@ -123,12 +123,6 @@ public void doExecute(TestContext context) { // fill the request test context variables (extract tag) fillContextVariables(columnValuesMap, context); - - // legacy: save all columns as variables TODO: remove in major version upgrade - for (Entry> column : columnValuesMap.entrySet()) { - List columnValues = column.getValue(); - context.setVariable(column.getKey().toUpperCase(), columnValues.get(0) == null ? NULL_VALUE : columnValues.get(0)); - } } catch (DataAccessException e) { logger.error("Failed to execute SQL statement", e); throw new CitrusRuntimeException(e); diff --git a/connectors/citrus-sql/src/test/java/org/citrusframework/actions/ExecuteSQLQueryActionTest.java b/connectors/citrus-sql/src/test/java/org/citrusframework/actions/ExecuteSQLQueryActionTest.java index fbc34288b3..d5569fd234 100644 --- a/connectors/citrus-sql/src/test/java/org/citrusframework/actions/ExecuteSQLQueryActionTest.java +++ b/connectors/citrus-sql/src/test/java/org/citrusframework/actions/ExecuteSQLQueryActionTest.java @@ -16,12 +16,7 @@ package org.citrusframework.actions; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +import org.apache.commons.codec.binary.Base64; import org.citrusframework.CitrusSettings; import org.citrusframework.UnitTestSupport; import org.citrusframework.context.TestContextFactory; @@ -30,17 +25,26 @@ import org.citrusframework.script.ScriptTypes; import org.citrusframework.validation.script.ScriptValidationContext; import org.citrusframework.validation.script.sql.SqlResultSetScriptValidator; -import org.apache.commons.codec.binary.Base64; import org.mockito.Mockito; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.TransactionStatus; +import org.springframework.transaction.support.TransactionTemplate; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -84,36 +88,38 @@ public void testSQLStatement() { when(jdbcTemplate.queryForList(sql)).thenReturn(Collections.singletonList(resultMap)); - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); + executeSQLQueryAction.statements(Collections.singletonList(sql)); + executeSQLQueryAction.extract("ORDERTYPE", "orderType"); + executeSQLQueryAction.extract("STATUS", "status"); executeSQLQueryAction.build().execute(context); - Assert.assertNotNull(context.getVariable("${ORDERTYPE}")); - Assert.assertEquals(context.getVariable("${ORDERTYPE}"), "small"); - Assert.assertNotNull(context.getVariable("${STATUS}")); - Assert.assertEquals(context.getVariable("${STATUS}"), "in_progress"); + Assert.assertNotNull(context.getVariable("${orderType}")); + Assert.assertEquals(context.getVariable("${orderType}"), "small"); + Assert.assertNotNull(context.getVariable("${status}")); + Assert.assertEquals(context.getVariable("${status}"), "in_progress"); } @Test public void testSQLStatementWithTransaction() { - String sql = DB_STMT_1; - reset(jdbcTemplate, transactionManager); + reset(jdbcTemplate, transactionManager); + TransactionStatus transactionStatusMock = mock(TransactionStatus.class); + doReturn(transactionStatusMock).when(transactionManager).getTransaction(any(TransactionTemplate.class)); Map resultMap = new HashMap<>(); resultMap.put("ORDERTYPE", "small"); resultMap.put("STATUS", "in_progress"); - when(jdbcTemplate.queryForList(sql)).thenReturn(Collections.singletonList(resultMap)); - - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); - executeSQLQueryAction.transactionManager(transactionManager); + executeSQLQueryAction.transactionManager(transactionManager); + executeSQLQueryAction.extract("ORDERTYPE", "orderType"); + executeSQLQueryAction.extract("STATUS", "status"); executeSQLQueryAction.build().execute(context); - Assert.assertNotNull(context.getVariable("${ORDERTYPE}")); - Assert.assertEquals(context.getVariable("${ORDERTYPE}"), "small"); - Assert.assertNotNull(context.getVariable("${STATUS}")); - Assert.assertEquals(context.getVariable("${STATUS}"), "in_progress"); + verify(transactionManager).commit(transactionStatusMock); + + Assert.assertNotNull(context.getVariable("${orderType}")); + Assert.assertEquals(context.getVariable("${orderType}"), "small"); + Assert.assertNotNull(context.getVariable("${status}")); + Assert.assertEquals(context.getVariable("${status}"), "in_progress"); } @Test @@ -127,14 +133,15 @@ public void testSQLStatementLowerCaseColumnNames() { when(jdbcTemplate.queryForList(sql)).thenReturn(Collections.singletonList(resultMap)); - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); + executeSQLQueryAction.statements(Collections.singletonList(sql)); + executeSQLQueryAction.extract("ORDERTYPE", "orderType"); + executeSQLQueryAction.extract("STATUS", "status"); executeSQLQueryAction.build().execute(context); - Assert.assertNotNull(context.getVariable("${ORDERTYPE}")); - Assert.assertEquals(context.getVariable("${ORDERTYPE}"), "small"); - Assert.assertNotNull(context.getVariable("${STATUS}")); - Assert.assertEquals(context.getVariable("${STATUS}"), "in_progress"); + Assert.assertNotNull(context.getVariable("${orderType}")); + Assert.assertEquals(context.getVariable("${orderType}"), "small"); + Assert.assertNotNull(context.getVariable("${status}")); + Assert.assertEquals(context.getVariable("${status}"), "in_progress"); } @Test @@ -168,51 +175,26 @@ public void testSQLMultipleStatements() { statements.add(sql3); executeSQLQueryAction.statements(statements); + executeSQLQueryAction.extract("ORDERTYPE", "orderType"); + executeSQLQueryAction.extract("STATUS", "status"); + executeSQLQueryAction.extract("NAME", "name"); + executeSQLQueryAction.extract("HEIGHT", "height"); + executeSQLQueryAction.extract("ID", "id"); + executeSQLQueryAction.extract("FRAMEWORK_NAME", "frameworkName"); executeSQLQueryAction.build().execute(context); - Assert.assertNotNull(context.getVariable("${ORDERTYPE}")); - Assert.assertEquals(context.getVariable("${ORDERTYPE}"), "small"); - Assert.assertNotNull(context.getVariable("${STATUS}")); - Assert.assertEquals(context.getVariable("${STATUS}"), "in_progress"); - Assert.assertNotNull(context.getVariable("${NAME}")); - Assert.assertEquals(context.getVariable("${NAME}"), "Mickey Mouse"); - Assert.assertNotNull(context.getVariable("${HEIGHT}")); - Assert.assertEquals(context.getVariable("${HEIGHT}"), "0,3"); - Assert.assertNotNull(context.getVariable("${ID}")); - Assert.assertEquals(context.getVariable("${ID}"), "1234"); - Assert.assertNotNull(context.getVariable("${FRAMEWORK_NAME}")); - Assert.assertEquals(context.getVariable("${FRAMEWORK_NAME}"), "citrusframework/citrus"); - } - - @Test - public void testSQLResource() { - String sql1 = "SELECT ORDERTYPE, STATUS FROM orders WHERE ID=5"; - String sql2 = "SELECT NAME, HEIGHT FROM customers WHERE ID=1"; - reset(jdbcTemplate); - - Map resultMap1 = new HashMap<>(); - resultMap1.put("ORDERTYPE", "small"); - resultMap1.put("STATUS", "in_progress"); - - when(jdbcTemplate.queryForList(sql1)).thenReturn(Collections.singletonList(resultMap1)); - - Map resultMap2 = new HashMap<>(); - resultMap2.put("NAME", "Mickey Mouse"); - resultMap2.put("HEIGHT", "0,3"); - - when(jdbcTemplate.queryForList(sql2)).thenReturn(Collections.singletonList(resultMap2)); - - executeSQLQueryAction.sqlResource("classpath:org/citrusframework/actions/test-query.sql"); - executeSQLQueryAction.build().execute(context); - - Assert.assertNotNull(context.getVariable("${ORDERTYPE}")); - Assert.assertEquals(context.getVariable("${ORDERTYPE}"), "small"); - Assert.assertNotNull(context.getVariable("${STATUS}")); - Assert.assertEquals(context.getVariable("${STATUS}"), "in_progress"); - Assert.assertNotNull(context.getVariable("${NAME}")); - Assert.assertEquals(context.getVariable("${NAME}"), "Mickey Mouse"); - Assert.assertNotNull(context.getVariable("${HEIGHT}")); - Assert.assertEquals(context.getVariable("${HEIGHT}"), "0,3"); + Assert.assertNotNull(context.getVariable("${orderType}")); + Assert.assertEquals(context.getVariable("${orderType}"), "small"); + Assert.assertNotNull(context.getVariable("${status}")); + Assert.assertEquals(context.getVariable("${status}"), "in_progress"); + Assert.assertNotNull(context.getVariable("${name}")); + Assert.assertEquals(context.getVariable("${name}"), "Mickey Mouse"); + Assert.assertNotNull(context.getVariable("${height}")); + Assert.assertEquals(context.getVariable("${height}"), "0,3"); + Assert.assertNotNull(context.getVariable("${id}")); + Assert.assertEquals(context.getVariable("${id}"), "1234"); + Assert.assertNotNull(context.getVariable("${frameworkName}")); + Assert.assertEquals(context.getVariable("${frameworkName}"), "citrusframework/citrus"); } @Test @@ -226,14 +208,8 @@ public void testNullValue() { when(jdbcTemplate.queryForList(sql)).thenReturn(Collections.singletonList(resultMap)); - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); + executeSQLQueryAction.statements(Collections.singletonList(sql)); executeSQLQueryAction.build().execute(context); - - Assert.assertNotNull(context.getVariable("${ORDERTYPE}")); - Assert.assertEquals(context.getVariable("${ORDERTYPE}"), "small"); - Assert.assertNotNull(context.getVariable("${STATUS}")); - Assert.assertEquals(context.getVariable("${STATUS}"), "NULL"); } @Test @@ -249,38 +225,8 @@ public void testVariableSupport() { when(jdbcTemplate.queryForList(DB_STMT_1)).thenReturn(Collections.singletonList(resultMap)); - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); + executeSQLQueryAction.statements(Collections.singletonList(sql)); executeSQLQueryAction.build().execute(context); - - Assert.assertNotNull(context.getVariable("${ORDERTYPE}")); - Assert.assertEquals(context.getVariable("${ORDERTYPE}"), "small"); - Assert.assertNotNull(context.getVariable("${STATUS}")); - Assert.assertEquals(context.getVariable("${STATUS}"), "in_progress"); - } - - @Test - public void testExtractToVariables() { - String sql = DB_STMT_1; - reset(jdbcTemplate); - - Map resultMap = new HashMap<>(); - resultMap.put("ORDERTYPE", "small"); - resultMap.put("STATUS", "in_progress"); - - when(jdbcTemplate.queryForList(sql)).thenReturn(Collections.singletonList(resultMap)); - - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); - executeSQLQueryAction.extract("STATUS", "orderStatus"); - executeSQLQueryAction.build().execute(context); - - Assert.assertNotNull(context.getVariable("${orderStatus}")); - Assert.assertEquals(context.getVariable("${orderStatus}"), "in_progress"); - Assert.assertNotNull(context.getVariable("${ORDERTYPE}")); - Assert.assertEquals(context.getVariable("${ORDERTYPE}"), "small"); - Assert.assertNotNull(context.getVariable("${STATUS}")); - Assert.assertEquals(context.getVariable("${STATUS}"), "in_progress"); } @Test @@ -294,20 +240,15 @@ public void testExtractToVariablesLowerCaseColumnNames() { when(jdbcTemplate.queryForList(sql)).thenReturn(Collections.singletonList(resultMap)); - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); + executeSQLQueryAction.statements(Collections.singletonList(sql)); executeSQLQueryAction.extract("ordertype", "orderType"); executeSQLQueryAction.extract("STATUS", "orderStatus"); executeSQLQueryAction.build().execute(context); Assert.assertNotNull(context.getVariable("${orderStatus}")); Assert.assertEquals(context.getVariable("${orderStatus}"), "in_progress"); - Assert.assertNotNull(context.getVariable("${ORDERTYPE}")); - Assert.assertEquals(context.getVariable("${ORDERTYPE}"), "small"); Assert.assertNotNull(context.getVariable("${orderType}")); Assert.assertEquals(context.getVariable("${orderType}"), "small"); - Assert.assertNotNull(context.getVariable("${STATUS}")); - Assert.assertEquals(context.getVariable("${STATUS}"), "in_progress"); } @Test(expectedExceptions = {CitrusRuntimeException.class}) @@ -321,8 +262,7 @@ public void testExtractToVariablesUnknownColumnMapping() { when(jdbcTemplate.queryForList(sql)).thenReturn(Collections.singletonList(resultMap)); - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); + executeSQLQueryAction.statements(Collections.singletonList(sql)); executeSQLQueryAction.extract("UNKNOWN_COLUMN", "orderStatus"); executeSQLQueryAction.build().execute(context); } @@ -338,16 +278,10 @@ public void testResultSetValidation() { when(jdbcTemplate.queryForList(sql)).thenReturn(Collections.singletonList(resultMap)); - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); + executeSQLQueryAction.statements(Collections.singletonList(sql)); executeSQLQueryAction.validate("ORDERTYPE", "small"); executeSQLQueryAction.validate("STATUS", "in_progress"); executeSQLQueryAction.build().execute(context); - - Assert.assertNotNull(context.getVariable("${ORDERTYPE}")); - Assert.assertEquals(context.getVariable("${ORDERTYPE}"), "small"); - Assert.assertNotNull(context.getVariable("${STATUS}")); - Assert.assertEquals(context.getVariable("${STATUS}"), "in_progress"); } @Test @@ -361,16 +295,10 @@ public void testResultSetValidationLowerCase() { when(jdbcTemplate.queryForList(sql)).thenReturn(Collections.singletonList(resultMap)); - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); + executeSQLQueryAction.statements(Collections.singletonList(sql)); executeSQLQueryAction.validate("ORDERTYPE", "small"); executeSQLQueryAction.validate("STATUS", "in_progress"); executeSQLQueryAction.build().execute(context); - - Assert.assertNotNull(context.getVariable("${ORDERTYPE}")); - Assert.assertEquals(context.getVariable("${ORDERTYPE}"), "small"); - Assert.assertNotNull(context.getVariable("${STATUS}")); - Assert.assertEquals(context.getVariable("${STATUS}"), "in_progress"); } @Test @@ -384,16 +312,10 @@ public void testResultSetValidationWithAliasNames() { when(jdbcTemplate.queryForList(sql)).thenReturn(Collections.singletonList(resultMap)); - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); + executeSQLQueryAction.statements(Collections.singletonList(sql)); executeSQLQueryAction.validate("TYPE", "small"); executeSQLQueryAction.validate("STATE", "in_progress"); executeSQLQueryAction.build().execute(context); - - Assert.assertNotNull(context.getVariable("${TYPE}")); - Assert.assertEquals(context.getVariable("${TYPE}"), "small"); - Assert.assertNotNull(context.getVariable("${STATE}")); - Assert.assertEquals(context.getVariable("${STATE}"), "in_progress"); } @Test @@ -407,8 +329,7 @@ public void testResultSetValidationError() { when(jdbcTemplate.queryForList(sql)).thenReturn(Collections.singletonList(resultMap)); - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); + executeSQLQueryAction.statements(Collections.singletonList(sql)); executeSQLQueryAction.validate("ORDERTYPE", "xxl"); //this is supposed to cause an error executeSQLQueryAction.validate("STATUS", "in_progress"); @@ -446,16 +367,10 @@ public void testResultSetMultipleRowsValidation() { when(jdbcTemplate.queryForList(sql)).thenReturn(resultList); - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); + executeSQLQueryAction.statements(Collections.singletonList(sql)); executeSQLQueryAction.validate("ORDERTYPE", "small", "medium", "big"); executeSQLQueryAction.validate("STATUS", "started", "in_progress", "finished"); executeSQLQueryAction.build().execute(context); - - Assert.assertNotNull(context.getVariable("ORDERTYPE")); - Assert.assertEquals(context.getVariable("ORDERTYPE"), "small"); - Assert.assertNotNull(context.getVariable("STATUS")); - Assert.assertEquals(context.getVariable("STATUS"), "started"); } @Test @@ -480,16 +395,10 @@ public void testNullValuesInMultipleRowsValidation() { when(jdbcTemplate.queryForList(sql)).thenReturn(resultList); - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); + executeSQLQueryAction.statements(Collections.singletonList(sql)); executeSQLQueryAction.validate("ORDERTYPE", "small", "medium", ""); // 1st possibility to validate null values executeSQLQueryAction.validate("STATUS", "NULL", "in_progress", "finished"); // 2nd possibility to validate null values executeSQLQueryAction.build().execute(context); - - Assert.assertNotNull(context.getVariable("ORDERTYPE")); - Assert.assertEquals(context.getVariable("ORDERTYPE"), "small"); - Assert.assertNotNull(context.getVariable("STATUS")); - Assert.assertEquals(context.getVariable("STATUS"), "NULL"); } @Test @@ -514,16 +423,10 @@ public void testIgnoreInMultipleRowsValidation() { when(jdbcTemplate.queryForList(sql)).thenReturn(resultList); - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); + executeSQLQueryAction.statements(Collections.singletonList(sql)); executeSQLQueryAction.validate("ORDERTYPE", "small", CitrusSettings.IGNORE_PLACEHOLDER, "big"); executeSQLQueryAction.validate("STATUS", CitrusSettings.IGNORE_PLACEHOLDER, "in_progress", "finished"); executeSQLQueryAction.build().execute(context); - - Assert.assertNotNull(context.getVariable("ORDERTYPE")); - Assert.assertEquals(context.getVariable("ORDERTYPE"), "small"); - Assert.assertNotNull(context.getVariable("STATUS")); - Assert.assertEquals(context.getVariable("STATUS"), "started"); } @Test @@ -548,8 +451,7 @@ public void testExtractMultipleRowValues() { when(jdbcTemplate.queryForList(sql)).thenReturn(resultList); - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); + executeSQLQueryAction.statements(Collections.singletonList(sql)); executeSQLQueryAction.extract("STATUS", "orderStatus"); executeSQLQueryAction.extract("ORDERTYPE", "orderType"); executeSQLQueryAction.validate("ORDERTYPE", "small", CitrusSettings.IGNORE_PLACEHOLDER, "big"); @@ -560,10 +462,6 @@ public void testExtractMultipleRowValues() { Assert.assertEquals(context.getVariable("orderType"), "small;NULL;big"); Assert.assertNotNull(context.getVariable("orderStatus")); Assert.assertEquals(context.getVariable("orderStatus"), "started;in_progress;finished"); - Assert.assertNotNull(context.getVariable("ORDERTYPE")); - Assert.assertEquals(context.getVariable("ORDERTYPE"), "small"); - Assert.assertNotNull(context.getVariable("STATUS")); - Assert.assertEquals(context.getVariable("STATUS"), "started"); } @Test @@ -604,6 +502,7 @@ public void testMultipleStatementsValidationError() { return; } + Assert.fail("Expected test to fail with " + ValidationException.class + " but was successful"); } @@ -626,16 +525,20 @@ public void testSQLStatementsWithFileResource() { when(jdbcTemplate.queryForList(sql2)).thenReturn(Collections.singletonList(resultMap2)); executeSQLQueryAction.sqlResource("classpath:org/citrusframework/actions/test-sql-query-statements.sql"); + executeSQLQueryAction.extract("ORDERTYPE", "orderType"); + executeSQLQueryAction.extract("STATUS", "status"); + executeSQLQueryAction.extract("NAME", "name"); + executeSQLQueryAction.extract("HEIGHT", "height"); executeSQLQueryAction.build().execute(context); - Assert.assertNotNull(context.getVariable("${ORDERTYPE}")); - Assert.assertEquals(context.getVariable("${ORDERTYPE}"), "small"); - Assert.assertNotNull(context.getVariable("${STATUS}")); - Assert.assertEquals(context.getVariable("${STATUS}"), "in_progress"); - Assert.assertNotNull(context.getVariable("${NAME}")); - Assert.assertEquals(context.getVariable("${NAME}"), "Mickey Mouse"); - Assert.assertNotNull(context.getVariable("${HEIGHT}")); - Assert.assertEquals(context.getVariable("${HEIGHT}"), "0,3"); + Assert.assertNotNull(context.getVariable("${orderType}")); + Assert.assertEquals(context.getVariable("${orderType}"), "small"); + Assert.assertNotNull(context.getVariable("${status}")); + Assert.assertEquals(context.getVariable("${status}"), "in_progress"); + Assert.assertNotNull(context.getVariable("${name}")); + Assert.assertEquals(context.getVariable("${name}"), "Mickey Mouse"); + Assert.assertNotNull(context.getVariable("${height}")); + Assert.assertEquals(context.getVariable("${height}"), "0,3"); } @Test @@ -649,8 +552,7 @@ public void testResultSetScriptValidation() { when(jdbcTemplate.queryForList(sql)).thenReturn(Collections.singletonList(resultMap)); - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); + executeSQLQueryAction.statements(Collections.singletonList(sql)); String validationScript = "assert rows.size() == 1\n" + "assert rows[0].ORDERTYPE == 'small'\n" + @@ -658,16 +560,11 @@ public void testResultSetScriptValidation() { executeSQLQueryAction.validateScript(validationScript, ScriptTypes.GROOVY); executeSQLQueryAction.build().execute(context); - Assert.assertNotNull(context.getVariable("${ORDERTYPE}")); - Assert.assertEquals(context.getVariable("${ORDERTYPE}"), "small"); - Assert.assertNotNull(context.getVariable("${STATUS}")); - Assert.assertEquals(context.getVariable("${STATUS}"), "in_progress"); - verify(resultSetScriptValidator).validateSqlResultSet(any(List.class), any(ScriptValidationContext.class), eq(context)); } @Test - public void testResultSetScriptValidationMultiplestatements() { + public void testResultSetScriptValidationMultipleStatements() { String sql1 = "select ORDERTYPES, STATUS from orders where ID=5"; String sql2 = "select ERRORTYPES from types"; reset(jdbcTemplate); @@ -715,8 +612,7 @@ public void testResultSetScriptValidationWrongValue() { when(jdbcTemplate.queryForList(sql)).thenReturn(Collections.singletonList(resultMap)); - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); + executeSQLQueryAction.statements(Collections.singletonList(sql)); String validationScript = "assert rows.size() == 1\n" + "assert rows[0] == [ORDERTYPE:'big', STATUS:'in_progress']"; @@ -746,8 +642,7 @@ public void testResultSetScriptValidationCombination() { when(jdbcTemplate.queryForList(sql)).thenReturn(Collections.singletonList(resultMap)); - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); + executeSQLQueryAction.statements(Collections.singletonList(sql)); executeSQLQueryAction.validate("ORDERTYPE", "small"); executeSQLQueryAction.validate("STATUS", "in_progress"); @@ -771,8 +666,7 @@ public void testResultSetValidationWithVariableAndFunction() { when(jdbcTemplate.queryForList(sql)).thenReturn(Collections.singletonList(resultMap)); - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); + executeSQLQueryAction.statements(Collections.singletonList(sql)); executeSQLQueryAction.validate("ORDERTYPE", "${testVariable}"); executeSQLQueryAction.validate("STATUS", "citrus:concat('in_', ${progressVar})"); @@ -793,8 +687,7 @@ public void testBinaryBlobColumnValues() { when(jdbcTemplate.queryForList(sql)).thenReturn(Collections.singletonList(resultMap)); - List statements = Collections.singletonList(sql); - executeSQLQueryAction.statements(statements); + executeSQLQueryAction.statements(Collections.singletonList(sql)); executeSQLQueryAction.extract("BINARY_DATA", "binaryData"); executeSQLQueryAction.build().execute(context);