How to use evaluateCondition_ifStringNotContains method of org.cerberus.engine.execution.impl.ConditionService class

Best Cerberus-source code snippet using org.cerberus.engine.execution.impl.ConditionService.evaluateCondition_ifStringNotContains

Source:ConditionService.java Github

copy

Full Screen

...126 ans = evaluateCondition_ifStringContains(conditionOper, conditionValue1, conditionValue2, conditionValue3);127 mes = ans.getResultMessage();128 break;129 case TestCaseStepAction.CONDITIONOPER_IFSTRINGNOTCONTAINS:130 ans = evaluateCondition_ifStringNotContains(conditionOper, conditionValue1, conditionValue2, conditionValue3);131 mes = ans.getResultMessage();132 break;133 case TestCaseStepAction.CONDITIONOPER_NEVER:134 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FALSE_NEVER);135 mes.setDescription(mes.getDescription().replace("%COND%", conditionOper));136 break;137 case TestCaseStepAction.CONDITIONOPER_IFTEXTINELEMENT:138 ans = evaluateCondition_ifTextInElement(tCExecution, conditionValue1, conditionValue2, conditionOper, conditionValue3);139 mes = ans.getResultMessage();140 break;141 case TestCaseStepAction.CONDITIONOPER_IFTEXTNOTINELEMENT:142 ans = evaluateCondition_ifTextNotInElement(tCExecution, conditionValue1, conditionValue2, conditionOper, conditionValue3);143 mes = ans.getResultMessage();144 break;145 default:146 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FAILED_UNKNOWNCONDITION);147 mes.setDescription(mes.getDescription().replace("%COND%", conditionOper));148 }149 LOG.debug("Finished Evaluation condition : " + mes.getCodeString());150 // the decision whether we execute the action/control/step is taken from the codeString of the message.151 if (mes.getCodeString().equals("OK")) { // If code is OK, we execute the Operation.152 execute_Operation = true;153 } else { // Any other status and we don't execute anything.154 execute_Operation = false;155 }156 ans.setItem(execute_Operation);157 ans.setResultMessage(mes);158 return ans;159 }160 private AnswerItem<Boolean> evaluateCondition_ifTextInElement(TestCaseExecution tCExecution, String path, String expected, String conditionOper, String isCaseSensitive) {161 if (LOG.isDebugEnabled()) {162 LOG.debug("Checking ifTextInElement on " + path + " element against value: " + expected);163 }164 AnswerItem<Boolean> ans = new AnswerItem<>();165 MessageEvent resultControlMes = new MessageEvent(MessageEventEnum.ACTION_SUCCESS);166 isCaseSensitive = defaultIsSensitiveValue(isCaseSensitive);167 resultControlMes = controlService.verifyTextInElement(tCExecution, path, expected, isCaseSensitive);168 if ("OK".equals(resultControlMes.getCodeString())) {169 MessageEvent resultCondMes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_TRUE_TEXTINELEMENT);170 ans.setItem(true);171 ans.setResultMessage(resultCondMes);172 return ans;173 } else {174 MessageEvent resultCondMes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FALSE_TEXTINELEMENT);175 resultCondMes.setDescription(resultCondMes.getDescription().replace("%ERRORMESS%", resultControlMes.getDescription()));176 ans.setItem(false);177 ans.setResultMessage(resultCondMes);178 return ans;179 }180 }181 private AnswerItem<Boolean> evaluateCondition_ifTextNotInElement(TestCaseExecution tCExecution, String path, String expected, String conditionOper, String isCaseSensitive) {182 if (LOG.isDebugEnabled()) {183 LOG.debug("Checking ifTextInElement on " + path + " element against value: " + expected);184 }185 AnswerItem<Boolean> ans = new AnswerItem<>();186 MessageEvent resultMes = new MessageEvent(MessageEventEnum.ACTION_SUCCESS);187 isCaseSensitive = defaultIsSensitiveValue(isCaseSensitive);188 resultMes = controlService.verifyTextNotInElement(tCExecution, path, expected, isCaseSensitive);189 if ("OK".equals(resultMes.getCodeString())) {190 MessageEvent resultCondMes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_TRUE_TEXTNOTINELEMENT);191 ans.setItem(true);192 ans.setResultMessage(resultCondMes);193 return ans;194 } else {195 MessageEvent resultCondMes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FALSE_TEXTNOTINELEMENT);196 resultCondMes.setDescription(resultCondMes.getDescription().replace("%ERRORMESS%", resultMes.getDescription()));197 ans.setItem(false);198 ans.setResultMessage(resultCondMes);199 return ans;200 }201 }202 private AnswerItem<Boolean> evaluateCondition_ifPropertyExist(String conditionOper, String conditionValue1, TestCaseExecution tCExecution) {203 if (LOG.isDebugEnabled()) {204 LOG.debug("Checking if property Exist");205 }206 AnswerItem<Boolean> ans = new AnswerItem<>();207 MessageEvent mes;208 if (StringUtil.isNullOrEmpty(conditionValue1)) {209 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FAILED_IFPROPERTYEXIST_MISSINGPARAMETER);210 mes.setDescription(mes.getDescription().replace("%COND%", conditionOper));211 } else {212 String myCountry = tCExecution.getCountry();213 String myProperty = conditionValue1;214 boolean execute_Action = false;215 for (TestCaseCountryProperties prop : tCExecution.getTestCaseCountryPropertyList()) {216 LOG.debug(prop.getCountry() + " - " + myCountry + " - " + prop.getProperty() + " - " + myProperty);217 if ((prop.getCountry().equals(myCountry)) && (prop.getProperty().equals(myProperty))) {218 execute_Action = true;219 }220 }221 if (execute_Action == false) {222 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FALSE_IFPROPERTYEXIST);223 mes.setDescription(mes.getDescription().replace("%COND%", conditionOper));224 mes.setDescription(mes.getDescription().replace("%PROP%", conditionValue1));225 mes.setDescription(mes.getDescription().replace("%COUNTRY%", tCExecution.getCountry()));226 } else {227 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_TRUE_IFPROPERTYEXIST);228 mes.setDescription(mes.getDescription().replace("%COND%", conditionOper));229 mes.setDescription(mes.getDescription().replace("%PROP%", conditionValue1));230 mes.setDescription(mes.getDescription().replace("%COUNTRY%", tCExecution.getCountry()));231 }232 }233 ans.setResultMessage(mes);234 return ans;235 }236 private AnswerItem<Boolean> evaluateCondition_ifPropertyNotExist(String conditionOper, String conditionValue1, TestCaseExecution tCExecution) {237 if (LOG.isDebugEnabled()) {238 LOG.debug("Checking if property Does not Exist");239 }240 AnswerItem<Boolean> ans = new AnswerItem<>();241 MessageEvent mes;242 if (StringUtil.isNullOrEmpty(conditionValue1)) {243 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FAILED_IFPROPERTYNOTEXIST_MISSINGPARAMETER);244 mes.setDescription(mes.getDescription().replace("%COND%", conditionOper));245 } else {246 String myCountry = tCExecution.getCountry();247 String myProperty = conditionValue1;248 boolean execute_Action = true;249 for (TestCaseCountryProperties prop : tCExecution.getTestCaseCountryPropertyList()) {250 LOG.debug(prop.getCountry() + " - " + myCountry + " - " + prop.getProperty() + " - " + myProperty);251 if ((prop.getCountry().equals(myCountry)) && (prop.getProperty().equals(myProperty))) {252 execute_Action = false;253 }254 }255 if (execute_Action == false) {256 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FALSE_IFPROPERTYNOTEXIST);257 mes.setDescription(mes.getDescription().replace("%COND%", conditionOper));258 mes.setDescription(mes.getDescription().replace("%PROP%", conditionValue1));259 mes.setDescription(mes.getDescription().replace("%COUNTRY%", tCExecution.getCountry()));260 } else {261 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_TRUE_IFPROPERTYNOTEXIST);262 mes.setDescription(mes.getDescription().replace("%COND%", conditionOper));263 mes.setDescription(mes.getDescription().replace("%PROP%", conditionValue1));264 mes.setDescription(mes.getDescription().replace("%COUNTRY%", tCExecution.getCountry()));265 }266 }267 ans.setResultMessage(mes);268 return ans;269 }270 private AnswerItem<Boolean> evaluateCondition_ifElementPresent(String conditionOper, String conditionValue1, TestCaseExecution tCExecution) {271 if (LOG.isDebugEnabled()) {272 LOG.debug("Checking if Element Present");273 }274 AnswerItem<Boolean> ans = new AnswerItem<>();275 MessageEvent mes;276 if (tCExecution.getManualExecution().equals("Y")) {277 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_NOTPOSSIBLE);278 } else if (StringUtil.isNullOrEmpty(conditionValue1)) {279 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FAILED_IFELEMENTPRESENT_MISSINGPARAMETER);280 mes.setDescription(mes.getDescription().replace("%COND%", conditionOper));281 } else {282 boolean condition_result = false;283 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)284 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)285 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {286 Identifier identifier = identifierService.convertStringToIdentifier(conditionValue1);287 try {288 if (this.webdriverService.isElementPresent(tCExecution.getSession(), identifier)) {289 condition_result = true;290 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_TRUE_IFELEMENTPRESENT);291 mes.setDescription(mes.getDescription().replace("%ELEMENT%", conditionValue1));292 } else {293 condition_result = false;294 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FALSE_IFELEMENTPRESENT);295 mes.setDescription(mes.getDescription().replace("%ELEMENT%", conditionValue1));296 }297 } catch (WebDriverException exception) {298 condition_result = false;299 mes = parseWebDriverException(exception);300 }301 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_SRV)) {302 if (tCExecution.getLastServiceCalled() != null) {303 String responseBody = tCExecution.getLastServiceCalled().getResponseHTTPBody();304 switch (tCExecution.getLastServiceCalled().getResponseHTTPBodyContentType()) {305 case AppService.RESPONSEHTTPBODYCONTENTTYPE_XML:306 if (LOG.isDebugEnabled()) {307 LOG.debug("Checking if Element Present - XML");308 }309 if (xmlUnitService.isElementPresent(responseBody, conditionValue1)) {310 condition_result = true;311 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_TRUE_IFELEMENTPRESENT);312 mes.setDescription(mes.getDescription().replace("%ELEMENT%", conditionValue1));313 } else {314 condition_result = false;315 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FALSE_IFELEMENTPRESENT);316 mes.setDescription(mes.getDescription().replace("%ELEMENT%", conditionValue1));317 }318 break;319 case AppService.RESPONSEHTTPBODYCONTENTTYPE_JSON:320 if (LOG.isDebugEnabled()) {321 LOG.debug("Checking if Element Present - JSON");322 }323 try {324 if (jsonService.getFromJson(responseBody, null, conditionValue1) != null) {325 condition_result = true;326 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_TRUE_IFELEMENTPRESENT);327 mes.setDescription(mes.getDescription().replace("%ELEMENT%", conditionValue1));328 } else {329 condition_result = false;330 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FALSE_IFELEMENTPRESENT);331 mes.setDescription(mes.getDescription().replace("%ELEMENT%", conditionValue1));332 }333 } catch (Exception ex) {334 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FAILED_GENERIC);335 mes.setDescription(mes.getDescription().replace("%ERROR%", ex.toString()));336 }337 break;338 default:339 condition_result = false;340 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FAILED_NOTSUPPORTED_FOR_MESSAGETYPE);341 mes.setDescription(mes.getDescription().replace("%TYPE%", tCExecution.getLastServiceCalled().getResponseHTTPBodyContentType()));342 mes.setDescription(mes.getDescription().replace("%CONDITION%", conditionOper));343 }344 } else {345 condition_result = false;346 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FAILED_NOOBJECTINMEMORY);347 }348 } else {349 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FAILED_NOTSUPPORTED_FOR_APPLICATION);350 mes.setDescription(mes.getDescription().replace("%CONDITION%", conditionOper));351 mes.setDescription(mes.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));352 }353 }354 ans.setResultMessage(mes);355 return ans;356 }357 private AnswerItem<Boolean> evaluateCondition_ifElementNotPresent(String conditionOper, String conditionValue1, TestCaseExecution tCExecution) {358 if (LOG.isDebugEnabled()) {359 LOG.debug("Checking if Element is Not Present");360 }361 AnswerItem<Boolean> ans = new AnswerItem<>();362 MessageEvent mes;363 if (tCExecution.getManualExecution().equals("Y")) {364 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_NOTPOSSIBLE);365 } else if (StringUtil.isNullOrEmpty(conditionValue1)) {366 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FAILED_IFELEMENTNOTPRESENT_MISSINGPARAMETER);367 mes.setDescription(mes.getDescription().replace("%COND%", conditionOper));368 } else {369 boolean condition_result = false;370 Identifier identifier = identifierService.convertStringToIdentifier(conditionValue1);371 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)372 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)373 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {374 try {375 if (identifier.getIdentifier().equals("picture")) {376 mes = sikuliService.doSikuliVerifyElementNotPresent(tCExecution.getSession(), identifier.getLocator());377 if (mes.equals(new MessageEvent(MessageEventEnum.CONTROL_SUCCESS_NOTPRESENT))) {378 condition_result = true;379 } else {380 condition_result = false;381 }382 } else if (!this.webdriverService.isElementPresent(tCExecution.getSession(), identifier)) {383 condition_result = true;384 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_TRUE_IFELEMENTNOTPRESENT);385 mes.setDescription(mes.getDescription().replace("%ELEMENT%", conditionValue1));386 } else {387 condition_result = false;388 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FALSE_IFELEMENTNOTPRESENT);389 mes.setDescription(mes.getDescription().replace("%ELEMENT%", conditionValue1));390 }391 } catch (WebDriverException exception) {392 condition_result = false;393 mes = parseWebDriverException(exception);394 }395 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_SRV)) {396 if (tCExecution.getLastServiceCalled() != null) {397 String responseBody = tCExecution.getLastServiceCalled().getResponseHTTPBody();398 switch (tCExecution.getLastServiceCalled().getResponseHTTPBodyContentType()) {399 case AppService.RESPONSEHTTPBODYCONTENTTYPE_XML:400 if (!xmlUnitService.isElementPresent(responseBody, conditionValue1)) {401 condition_result = true;402 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_TRUE_IFELEMENTNOTPRESENT);403 mes.setDescription(mes.getDescription().replace("%ELEMENT%", conditionValue1));404 } else {405 condition_result = false;406 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FALSE_IFELEMENTNOTPRESENT);407 mes.setDescription(mes.getDescription().replace("%ELEMENT%", conditionValue1));408 }409 break;410 case AppService.RESPONSEHTTPBODYCONTENTTYPE_JSON:411 try {412 if (jsonService.getFromJson(responseBody, null, conditionValue1) == null) {413 condition_result = true;414 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_TRUE_IFELEMENTNOTPRESENT);415 mes.setDescription(mes.getDescription().replace("%ELEMENT%", conditionValue1));416 } else {417 condition_result = false;418 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FALSE_IFELEMENTNOTPRESENT);419 mes.setDescription(mes.getDescription().replace("%ELEMENT%", conditionValue1));420 }421 } catch (Exception ex) {422 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FAILED_GENERIC);423 mes.setDescription(mes.getDescription().replace("%ERROR%", ex.toString()));424 }425 break;426 default:427 condition_result = false;428 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FAILED_NOTSUPPORTED_FOR_MESSAGETYPE);429 mes.setDescription(mes.getDescription().replace("%TYPE%", tCExecution.getLastServiceCalled().getResponseHTTPBodyContentType()));430 mes.setDescription(mes.getDescription().replace("%CONDITION%", conditionOper));431 }432 } else {433 condition_result = false;434 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FAILED_NOOBJECTINMEMORY);435 }436 } else {437 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FAILED_NOTSUPPORTED_FOR_APPLICATION);438 mes.setDescription(mes.getDescription().replace("%CONDITION%", conditionOper));439 mes.setDescription(mes.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));440 }441 }442 ans.setResultMessage(mes);443 return ans;444 }445 private AnswerItem<Boolean> evaluateCondition_ifStringEqual(String conditionOper, String conditionValue1, String conditionValue2, String isCaseSensitive) {446 if (LOG.isDebugEnabled()) {447 LOG.debug("Checking if String Equal");448 }449 AnswerItem<Boolean> ans = new AnswerItem<>();450 MessageEvent mes;451 isCaseSensitive = defaultIsSensitiveValue(isCaseSensitive);452 if (ParameterParserUtil.parseBooleanParam(isCaseSensitive, false) ? conditionValue1.equals(conditionValue2) : conditionValue1.equalsIgnoreCase(conditionValue2)) {453 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_TRUE_STRINGEQUAL);454 mes.setDescription(mes.getDescription()455 .replace("%COND%", conditionOper)456 .replace("%STR1%", conditionValue1)457 .replace("%STR2%", conditionValue2)458 .replace("%STRING3%", caseSensitiveMessageValue(isCaseSensitive))459 );460 } else {461 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FALSE_STRINGEQUAL);462 mes.setDescription(mes.getDescription()463 .replace("%COND%", conditionOper)464 .replace("%STR1%", conditionValue1)465 .replace("%STR2%", conditionValue2)466 .replace("%STRING3%", caseSensitiveMessageValue(isCaseSensitive))467 );468 }469 ans.setResultMessage(mes);470 return ans;471 }472 private AnswerItem<Boolean> evaluateCondition_ifStringDifferent(String conditionOper, String conditionValue1, String conditionValue2, String isCaseSensitive) {473 if (LOG.isDebugEnabled()) {474 LOG.debug("Checking if String Different");475 }476 AnswerItem<Boolean> ans = new AnswerItem<>();477 MessageEvent mes;478 isCaseSensitive = defaultIsSensitiveValue(isCaseSensitive);479 boolean execute_Action = true;480 if (!(ParameterParserUtil.parseBooleanParam(isCaseSensitive, false) ? conditionValue1.equals(conditionValue2) : conditionValue1.equalsIgnoreCase(conditionValue2))) {481 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_TRUE_STRINGDIFFERENT);482 mes.setDescription(mes.getDescription()483 .replace("%COND%", conditionOper)484 .replace("%STR1%", conditionValue1)485 .replace("%STR2%", conditionValue2)486 .replace("%STRING3%", caseSensitiveMessageValue(isCaseSensitive))487 );488 } else {489 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FALSE_STRINGDIFFERENT);490 mes.setDescription(mes.getDescription()491 .replace("%COND%", conditionOper)492 .replace("%STR1%", conditionValue1)493 .replace("%STR2%", conditionValue2)494 .replace("%STRING3%", caseSensitiveMessageValue(isCaseSensitive))495 );496 }497 ans.setItem(execute_Action);498 ans.setResultMessage(mes);499 return ans;500 }501 private AnswerItem<Boolean> evaluateCondition_ifStringGreater(String conditionOper, String conditionValue1, String conditionValue2) {502 if (LOG.isDebugEnabled()) {503 LOG.debug("Checking if String Greater");504 }505 AnswerItem<Boolean> ans = new AnswerItem<>();506 MessageEvent mes;507 boolean execute_Action = true;508 if ((conditionValue1.compareToIgnoreCase(conditionValue2) > 0)) {509 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_TRUE_STRINGGREATER);510 mes.setDescription(mes.getDescription()511 .replace("%COND%", conditionOper)512 .replace("%STR1%", conditionValue1).replace("%STR2%", conditionValue2)513 );514 } else {515 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FALSE_STRINGGREATER);516 mes.setDescription(mes.getDescription()517 .replace("%COND%", conditionOper)518 .replace("%STR1%", conditionValue1).replace("%STR2%", conditionValue2)519 );520 }521 ans.setItem(execute_Action);522 ans.setResultMessage(mes);523 return ans;524 }525 private AnswerItem<Boolean> evaluateCondition_ifStringMinor(String conditionOper, String conditionValue1, String conditionValue2) {526 if (LOG.isDebugEnabled()) {527 LOG.debug("Checking if String Minor");528 }529 AnswerItem<Boolean> ans = new AnswerItem<>();530 MessageEvent mes;531 boolean execute_Action = true;532 if ((conditionValue1.compareToIgnoreCase(conditionValue2) < 0)) {533 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_TRUE_STRINGMINOR);534 mes.setDescription(mes.getDescription()535 .replace("%COND%", conditionOper)536 .replace("%STR1%", conditionValue1).replace("%STR2%", conditionValue2)537 );538 } else {539 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FALSE_STRINGMINOR);540 mes.setDescription(mes.getDescription()541 .replace("%COND%", conditionOper)542 .replace("%STR1%", conditionValue1).replace("%STR2%", conditionValue2)543 );544 }545 ans.setItem(execute_Action);546 ans.setResultMessage(mes);547 return ans;548 }549 private AnswerItem<Boolean> evaluateCondition_ifStringContains(String conditionOper, String conditionValue1, String conditionValue2, String isCaseSensitive) {550 if (LOG.isDebugEnabled()) {551 LOG.debug("Checking if String Contains");552 }553 AnswerItem<Boolean> ans = new AnswerItem<>();554 MessageEvent mes;555 isCaseSensitive = defaultIsSensitiveValue(isCaseSensitive);556 boolean execute_Action = true;557 if (ParameterParserUtil.parseBooleanParam(isCaseSensitive, false) ? conditionValue1.contains(conditionValue2) : conditionValue1.toLowerCase().contains(conditionValue2.toLowerCase())) {558 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_TRUE_STRINGCONTAINS);559 mes.setDescription(mes.getDescription()560 .replace("%COND%", conditionOper)561 .replace("%STR1%", conditionValue1)562 .replace("%STR2%", conditionValue2)563 .replace("%STRING3%", caseSensitiveMessageValue(isCaseSensitive))564 );565// execute_Action = true;566 } else {567 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FALSE_STRINGCONTAINS);568 mes.setDescription(mes.getDescription()569 .replace("%COND%", conditionOper)570 .replace("%STR1%", conditionValue1)571 .replace("%STR2%", conditionValue2)572 .replace("%STRING3%", caseSensitiveMessageValue(isCaseSensitive))573 );574// execute_Action = false;575 }576 ans.setItem(execute_Action);577 ans.setResultMessage(mes);578 return ans;579 }580 private AnswerItem<Boolean> evaluateCondition_ifStringNotContains(String conditionOper, String conditionValue1, String conditionValue2, String isCaseSensitive) {581 if (LOG.isDebugEnabled()) {582 LOG.debug("Checking if String Does Not Contains");583 }584 AnswerItem<Boolean> ans = new AnswerItem<>();585 MessageEvent mes;586 isCaseSensitive = defaultIsSensitiveValue(isCaseSensitive);587 boolean execute_Action = true;588 if (ParameterParserUtil.parseBooleanParam(isCaseSensitive, false) ? conditionValue1.contains(conditionValue2) : conditionValue1.toLowerCase().contains(conditionValue2.toLowerCase())) {589 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_FALSE_STRINGCONTAINS);590 mes.setDescription(mes.getDescription()591 .replace("%COND%", conditionOper)592 .replace("%STR1%", conditionValue1)593 .replace("%STR2%", conditionValue2)594 .replace("%STRING3%", caseSensitiveMessageValue(isCaseSensitive))...

Full Screen

Full Screen

evaluateCondition_ifStringNotContains

Using AI Code Generation

copy

Full Screen

1var conditionService = new org.cerberus.engine.execution.impl.ConditionService();2var result = conditionService.evaluateCondition_ifStringNotContains("hello world", "hello");3LOG.info("result: " + result);4var conditionService = new org.cerberus.engine.execution.impl.ConditionService();5var result = conditionService.evaluateCondition_ifStringNotContains("hello world", "bye");6LOG.info("result: " + result);7var conditionService = new org.cerberus.engine.execution.impl.ConditionService();8var result = conditionService.evaluateCondition_ifStringNotContains("hello world", "hello");9LOG.info("result: " + result);10var conditionService = new org.cerberus.engine.execution.impl.ConditionService();11var result = conditionService.evaluateCondition_ifStringNotContains("hello world", "bye");12LOG.info("result: " + result);13var conditionService = new org.cerberus.engine.execution.impl.ConditionService();14var result = conditionService.evaluateCondition_ifStringNotContains("hello world", "hello");15LOG.info("result: " + result);16var conditionService = new org.cerberus.engine.execution.impl.ConditionService();17var result = conditionService.evaluateCondition_ifStringNotContains("hello

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful