rebuilt for Java 1.8 and cleaned up some of the logging and int compare tests
This commit is contained in:
parent
e87d07fd65
commit
8fb7fb06ed
|
@ -8,6 +8,7 @@ plugins {
|
|||
|
||||
// Define the main class for the application
|
||||
mainClassName = 'org.reso.commander.Main'
|
||||
version = "0.1.1"
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
|
|
Binary file not shown.
|
@ -379,7 +379,7 @@ public class WebAPIServer_1_0_2 implements En {
|
|||
});
|
||||
|
||||
/*
|
||||
* True if data are present in the response.
|
||||
* True if data are present in the response
|
||||
*/
|
||||
And("^the response has singleton results in the \"([^\"]*)\" field$", (String parameterFieldName) -> {
|
||||
String value = Utils.resolveValue(parameterFieldName, settings);
|
||||
|
@ -400,10 +400,9 @@ public class WebAPIServer_1_0_2 implements En {
|
|||
});
|
||||
|
||||
/*
|
||||
* True if data in
|
||||
* True if data in the lhs expression and rhs expressions pass the AND or OR condition given in andOrOp
|
||||
*/
|
||||
And("^Integer data in \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\"$",
|
||||
(String parameterFieldName, String opLhs, String parameterAssertedLhsValue, String andOrOp, String opRhs, String parameterAssertedRhsValue) -> {
|
||||
And("^Integer data in \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\"$", (String parameterFieldName, String opLhs, String parameterAssertedLhsValue, String andOrOp, String opRhs, String parameterAssertedRhsValue) -> {
|
||||
String fieldName = Utils.resolveValue(parameterFieldName, settings);
|
||||
Integer assertedLhsValue = Integer.parseInt(Utils.resolveValue(parameterAssertedLhsValue, settings)),
|
||||
assertedRhsValue = Integer.parseInt(Utils.resolveValue(parameterAssertedRhsValue, settings));
|
||||
|
@ -424,12 +423,11 @@ public class WebAPIServer_1_0_2 implements En {
|
|||
lhsValue.set(Integer.parseInt(item.get(fieldName).toString()));
|
||||
rhsValue.set(Integer.parseInt(item.get(fieldName).toString()));
|
||||
|
||||
LOG.info("LHS:");
|
||||
LOG.info("Checking LHS");
|
||||
lhsResult.set(Utils.compare(lhsValue.get(), opLhs, assertedLhsValue));
|
||||
|
||||
LOG.info("RHS:");
|
||||
LOG.info("Checking RHS");
|
||||
rhsResult.set(Utils.compare(rhsValue.get(), opRhs, assertedRhsValue));
|
||||
});
|
||||
|
||||
if (op.contentEquals(Operators.AND)) {
|
||||
itemResult.set(lhsResult.get() && rhsResult.get());
|
||||
|
@ -441,9 +439,13 @@ public class WebAPIServer_1_0_2 implements En {
|
|||
assertTrue(itemResult.get());
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains the list of supported operators for use in query expressions.
|
||||
*/
|
||||
private static class Operators {
|
||||
private static final String
|
||||
AND = "and",
|
||||
|
@ -460,10 +462,10 @@ public class WebAPIServer_1_0_2 implements En {
|
|||
|
||||
/**
|
||||
* Returns true if each item in the list is true
|
||||
* @param lhs
|
||||
* @param op
|
||||
* @param rhs
|
||||
* @return
|
||||
* @param lhs left hand value
|
||||
* @param op a binary operator for use in comparsions
|
||||
* @param rhs right hand value
|
||||
* @return true if lhs op rhs produces true, false otherwise
|
||||
*/
|
||||
private static boolean compare(Integer lhs, String op, Integer rhs) {
|
||||
boolean result = false;
|
||||
|
|
Loading…
Reference in New Issue