@Override protected void populateAdditionalSearchValues(String[] input, ExampleSearch exampleSearch) { ArrayDesignSearch search = (ArrayDesignSearch) exampleSearch; if (headerIndexMap.get(ASSAY_TYPE) < input.length && !input[headerIndexMap.get(ASSAY_TYPE)].equals("")) { search .getArrayDesign() .getAssayTypes() .add(new AssayType(input[headerIndexMap.get(ASSAY_TYPE)])); } }
@Override protected void evaluateResults( List<? extends AbstractCaArrayEntity> resultsList, ExampleSearch search, TestResult testResult) { ArrayDesignSearch adSearch = (ArrayDesignSearch) search; List<ArrayDesign> adResults = (List<ArrayDesign>) resultsList; if (adSearch.getExpectedResults() != null || adSearch.getMinResults() != null) { int namedResults = 0; for (ArrayDesign arrayDesign : adResults) { if (arrayDesign.getName() != null) namedResults++; } if (adSearch.getExpectedResults() != null && namedResults != adSearch.getExpectedResults()) { testResult.setPassed(false); String detail = "Failed with unexpected number of results, ArrayDesign:" + adSearch.getArrayDesign().getName() + "- expected number of results: " + adSearch.getExpectedResults() + ", actual number of results: " + namedResults; testResult.addDetail(detail); } else { String detail = "Found expected number of results: " + namedResults; testResult.addDetail(detail); } if (adSearch.getMinResults() != null && namedResults < adSearch.getMinResults()) { testResult.setPassed(false); String detail = "Failed with unexpected minimum number of results, ArrayDesign:" + adSearch.getArrayDesign().getName() + "- expected number of results: " + adSearch.getMinResults() + ", actual number of results: " + namedResults; testResult.addDetail(detail); } } if (adSearch.getExample() == null) { if (adSearch.getExceptionClass() != null) { if (!adSearch.getExceptionClass().equals(InvalidInputException.class.toString()) && !adSearch.getExceptionClass().equals(InvalidInputFault.class.toString())) { testResult.setPassed(false); String detail = "Failed with unexpected exception class: " + adSearch.getExceptionClass(); testResult.addDetail(detail); } else { testResult.addDetail("Found expected exception " + adSearch.getExceptionClass()); } } } for (ArrayDesign arrayDesign : adResults) { if (adSearch.getExpectedProvider() != null) { if (arrayDesign.getArrayProvider() == null || !arrayDesign.getArrayProvider().getName().equals(adSearch.getExpectedProvider())) { testResult.setPassed(false); String detail = "Failed with unexpected array provider: " + (arrayDesign.getArrayProvider() == null ? "null" : arrayDesign.getArrayProvider().getName()) + ", expected provider: " + adSearch.getExpectedProvider(); testResult.addDetail(detail); } else { String detail = "Found expected provider: " + adSearch.getExpectedProvider(); testResult.addDetail(detail); } } if (adSearch.getExpectedOrganism() != null) { if (arrayDesign.getOrganism() == null || !arrayDesign .getOrganism() .getCommonName() .equalsIgnoreCase(adSearch.getExpectedOrganism())) { testResult.setPassed(false); String detail = "Failed with unexpected organism common name: " + (arrayDesign.getOrganism() == null ? "null" : arrayDesign.getOrganism().getCommonName()) + ", expected name: " + adSearch.getExpectedOrganism(); testResult.addDetail(detail); } else { String detail = "Found expected organism: " + adSearch.getExpectedOrganism(); testResult.addDetail(detail); } } } }