Best Testsigma code snippet using com.testsigma.specification.TestCaseSpecificationsBuilder.normalizeAppVersion
Source:TestCaseSpecificationsBuilder.java
...24 }25 List<SearchCriteria> criteriaList = filter.getSearchCriteria();26 Specification result = new TestCaseSpecification(criteriaList.get(0));27 for (SearchCriteria criteria : criteriaList) {28 normalizeAppVersion(criteria, version);29 normalizeEnums(criteria);30 normalizeDate(criteria);31 result = Specification.where(result).and(new TestCaseSpecification(criteria));32 }33 return result;34 }35 private void normalizeEnums(SearchCriteria criteria) {36 if (criteria.getKey().equals("status")) {37 Object[] values = ((ArrayList) criteria.getValue()).toArray();38 ArrayList<TestCaseStatus> normalizedList = new ArrayList<>();39 for (int index = 0; index < values.length; index++) {40 normalizedList.add(TestCaseStatus.valueOf(values[index].toString()));41 }42 criteria.setValue(normalizedList);43 }44 if (criteria.getKey().equals("result")) {45 Object[] values = ((ArrayList) criteria.getValue()).toArray();46 ArrayList<ResultConstant> normalizedList = new ArrayList<>();47 for (int index = 0; index < values.length; index++) {48 normalizedList.add(ResultConstant.valueOf(values[index].toString()));49 }50 criteria.setValue(normalizedList);51 }52 }53 private void normalizeAppVersion(SearchCriteria criteria, WorkspaceVersion version) {54 if (criteria.getKey().equals("workspaceVersionId") && criteria.getOperation().equals(SearchOperation.EQUALITY)) {55 if (criteria.getValue().toString().equals("-1")) {56 criteria.setValue(version.getId());57 } else {58 criteria.setValue(((IntNode) criteria.getValue()).asLong());59 }60 }61 }62 private void normalizeDate(SearchCriteria criteria) {63 if (criteria.getKey().equals("createdDate") || criteria.getKey().equals("updatedDate")) {64 criteria.setValue(criteria.getValue());65 }66 }67}...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!