diff --git a/build/libs/web-api-commander.jar b/build/libs/web-api-commander.jar index c17af24..0593212 100644 Binary files a/build/libs/web-api-commander.jar and b/build/libs/web-api-commander.jar differ diff --git a/generic.resoscript b/generic.resoscript index 667da85..f671019 100644 --- a/generic.resoscript +++ b/generic.resoscript @@ -282,48 +282,48 @@ /> { + And("^Integer data in \"([^\"]*)\" is \"([^\"]*)\" the value in \"([^\"]*)\"$", (String parameterFieldName, String op, String parameterAssertedValue) -> { LOG.info("Parameter_FieldName: " + parameterFieldName + ", op: " + op + ", Parameter_Value: " + parameterAssertedValue); String fieldName = Utils.resolveValue(parameterFieldName, settings); int assertedValue = Integer.parseInt(Utils.resolveValue(parameterAssertedValue, settings)); + AtomicReference fieldValue = new AtomicReference<>(); + //iterate through response data and ensure that with data, the statement fieldName "op" assertValue is true from(responseData.get()).getList(JSON_VALUE_PATH, HashMap.class).forEach(item -> { + fieldValue.set(Integer.parseInt(item.get(fieldName).toString())); if (op.equals("eq")) { - assertEquals(Integer.parseInt(item.get(fieldName).toString()), assertedValue); + assertEquals(fieldValue.get().intValue(), assertedValue); } else if (op.equals("ne")) { - assertTrue(Integer.parseInt(item.get(fieldName).toString()) != assertedValue); + assertTrue(fieldValue.get() != assertedValue); } else if (op.equals("gt")) { - assertTrue(Integer.parseInt(item.get(fieldName).toString()) > assertedValue); + assertTrue(fieldValue.get() > assertedValue); } else if (op.equals("ge")) { - assertTrue(Integer.parseInt(item.get(fieldName).toString()) >= assertedValue); + assertTrue(fieldValue.get() >= assertedValue); } else if (op.equals("lt")) { - assertTrue(Integer.parseInt(item.get(fieldName).toString()) < assertedValue); + assertTrue(fieldValue.get() < assertedValue); } else if (op.equals("le")) { - assertTrue(Integer.parseInt(item.get(fieldName).toString()) <= assertedValue); + assertTrue(fieldValue.get() <= assertedValue); } }); - }); + } private static class Utils { @@ -404,7 +407,6 @@ public class WebAPIServer_1_0_2 implements En { } } - /** * Resolves the given item into a value * @param item an item which can either be a reference to a parameter, client setting, or it can be an actual value.