I'm trying to write a parameterized test using a csv file as the data source. I would like to check the json node for a number if keys, if the are present. Here my first attempt:
@ParameterizedTest(name = "{index} => name={0}")
@CsvFileSource(resources = "fields.csv", numLinesToSkip = 0)
void verifyFields(String name) {
Response response = getResponse(); // rest - assured query response
response
.then()
.assertThat()
.body("components.any { it.containsKey('" + name + "') }", is(true));
But I keep getting the following error when trying to verify that the key xzy
is present:
Caused by: groovy.lang.MissingMethodException: No signature of method: java.util.HashMap$Node.containsKey() is applicable for argument types: (String) values: [xyz]
I'm not sure I'm using the groovy statement correctly. I'm just trying to use the parameters from the file.