Skip to content

[TE-9727] If test-data-1 == test-data-2 >> addon if condition NLP is failing with valid data #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,26 @@ public class ToCompare extends WebAction {
@Override
public Result execute() throws NoSuchElementException {
String operatorString = operator.getValue().toString();
int testDataString1 = Integer.valueOf(testData1.getValue().toString());
int testDataString2 = Integer.valueOf(testData2.getValue().toString());
String testDataString1 = testData1.getValue().toString();
String testDataString2 = testData2.getValue().toString();
Result returnResult = Result.FAILED;
switch (operatorString) {
case ">":
returnResult = testDataString1 > testDataString2 ? Result.SUCCESS : Result.FAILED;
break;
case "<":
returnResult = testDataString1 < testDataString2 ? Result.SUCCESS : Result.FAILED;
break;
case ">=":
returnResult = testDataString1 >= testDataString2 ? Result.SUCCESS : Result.FAILED;
break;
case "<=":
returnResult = testDataString1 <= testDataString2 ? Result.SUCCESS : Result.FAILED;
break;
case "==":
returnResult = testDataString1 == testDataString2 ? Result.SUCCESS : Result.FAILED;
break;
if(operatorString.equals(">")) {
returnResult = testDataString1.compareTo(testDataString2) > 0 ? Result.SUCCESS : Result.FAILED;
} else if(operatorString.equals("<")){
returnResult = testDataString1.compareTo(testDataString2) < 0 ? Result.SUCCESS : Result.FAILED;
} else if(operatorString.equals(">=")) {
returnResult = testDataString1.equals(testDataString2) || testDataString1.compareTo(testDataString2) > 0 ? Result.SUCCESS : Result.FAILED;
} else if(operatorString.equals("<=")){
returnResult = testDataString1.equals(testDataString2) || testDataString1.compareTo(testDataString2) < 0 ? Result.SUCCESS : Result.FAILED;
} else if(operatorString.equals("==")){
returnResult = testDataString1.equals(testDataString2) ? Result.SUCCESS : Result.FAILED;
} else {
returnResult = Result.FAILED;
}
if (returnResult.equals(Result.SUCCESS))
setSuccessMessage("The TestData satisfies the expected condition");
else
setErrorMessage("The TestData does not satisfy the expected condition");
return returnResult;
}
}

}