Search in sources :

Example 1 with TestResultImpl

use of org.asqatasun.webapp.presentation.data.TestResultImpl in project Asqatasun by Asqatasun.

the class TestResultFactory method getTestResult.

/**
     *
     * @param processResult
     * @param hasResultDetails
     * @param truncatable
     * @return an instance of ProcessResult
     */
public TestResult getTestResult(ProcessResult processResult, boolean hasResultDetails, boolean truncatable) {
    TestResult testResult = new TestResultImpl();
    testResult.setTestUrl(processResult.getTest().getDescription());
    testResult.setTestShortLabel(processResult.getTest().getLabel());
    testResult.setTestCode(processResult.getTest().getCode());
    testResult.setLevelCode(processResult.getTest().getLevel().getCode());
    testResult.setResult(processResult.getValue().toString());
    testResult.setResultCode(setResultToLowerCase(processResult, testResult));
    testResult.setRuleDesignUrl(processResult.getTest().getRuleDesignUrl());
    testResult.setResultCounter(ResultCounterFactory.getInstance().getResultCounter());
    testResult.setTest(processResult.getTest());
    testResult.setHistory(constructHistoryChanges(processResult));
    if (processResult instanceof DefiniteResult && processResult.getManualValue() != null) {
        testResult.setComment(((DefiniteResult) processResult).getManualAuditComment());
        switch((TestSolution) processResult.getManualValue()) {
            case FAILED:
                testResult.setManualResult(TestResult.FAILED_LOWER);
                break;
            case PASSED:
                testResult.setManualResult(TestResult.PASSED_LOWER);
                break;
            case NOT_APPLICABLE:
                testResult.setManualResult(TestResult.NOT_APPLICABLE_LOWER);
                break;
        }
    }
    try {
        testResult.setTestRepresentation(Integer.valueOf(representationBundle.getString(testResult.getTestCode() + TestResult.REPRESENTATION_SUFFIX_KEY)));
    } catch (MissingResourceException mre) {
        Logger.getLogger(this.getClass()).warn(mre);
    }
    try {
        testResult.setTestEvidenceRepresentationOrder(representationBundle.getString(testResult.getTestCode() + TestResult.REPRESENTATION_ORDER_SUFFIX_KEY));
    } catch (MissingResourceException mre) {
        Logger.getLogger(this.getClass()).warn(mre);
    }
    try {
        testResult.setColorTestContrastRatio(representationBundle.getString(testResult.getTestCode() + TestResult.CONTRAST_RATIO_SUFFIX_KEY));
    } catch (MissingResourceException mre) {
        Logger.getLogger(this.getClass()).warn(mre);
    }
    if (hasResultDetails && (testResult.getResult().equalsIgnoreCase(TestSolution.FAILED.toString()) || testResult.getResult().equalsIgnoreCase(TestSolution.NEED_MORE_INFO.toString()))) {
        addRemarkInfosMapToTestResult(testResult, processResult, truncatable);
    }
    return testResult;
}
Also used : TestResultImpl(org.asqatasun.webapp.presentation.data.TestResultImpl) TestResult(org.asqatasun.webapp.presentation.data.TestResult)

Aggregations

TestResult (org.asqatasun.webapp.presentation.data.TestResult)1 TestResultImpl (org.asqatasun.webapp.presentation.data.TestResultImpl)1