Search in sources :

Example 26 with ProcessRemark

use of org.asqatasun.entity.audit.ProcessRemark in project Asqatasun by Asqatasun.

the class Rgaa22Rule05291Test method setProcess.

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------3NMI-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("RGAA22.Test.5.29-3NMI-01");
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check test has no remark
    assertNotNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(3, processResult.getElementCounter());
    // check type of remarks and their value
    assertNotNull(processResult.getRemarkSet());
    SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
    // check number, type and value of remarks
    assertNotNull(processResult.getRemarkSet());
    assertEquals(3, processResult.getRemarkSet().size());
    for (ProcessRemark remark : processResult.getRemarkSet()) {
        processRemark = (SourceCodeRemark) remark;
        assertEquals(MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
    }
    //----------------------------------------------------------------------
    //------------------------------4NA-01------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("RGAA22.Test.5.29-4NA-01");
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
}
Also used : ProcessResult(org.asqatasun.entity.audit.ProcessResult) SourceCodeRemark(org.asqatasun.entity.audit.SourceCodeRemark) ProcessRemark(org.asqatasun.entity.audit.ProcessRemark)

Example 27 with ProcessRemark

use of org.asqatasun.entity.audit.ProcessRemark in project Asqatasun by Asqatasun.

the class Rgaa22Rule06251Test method setProcess.

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------3NMI-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("Rgaa22.Test.6.25-3NMI-01");
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check test has no remark
    assertNotNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(2, processResult.getElementCounter());
    // check type of remarks and their value
    assertNotNull(processResult.getRemarkSet());
    SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(CHECK_USER_IS_WARNED_IN_CASE_OF_NEW_WINDOW_MSG, processRemark.getMessageCode());
    // check number, type and value of remarks
    assertNotNull(processResult.getRemarkSet());
    assertEquals(2, processResult.getRemarkSet().size());
    for (ProcessRemark remark : processResult.getRemarkSet()) {
        processRemark = (SourceCodeRemark) remark;
        assertEquals(CHECK_USER_IS_WARNED_IN_CASE_OF_NEW_WINDOW_MSG, processRemark.getMessageCode());
    }
    //----------------------------------------------------------------------
    //------------------------------4NA-01------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.6.25-4NA-01");
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
}
Also used : ProcessResult(org.asqatasun.entity.audit.ProcessResult) SourceCodeRemark(org.asqatasun.entity.audit.SourceCodeRemark) ProcessRemark(org.asqatasun.entity.audit.ProcessRemark)

Example 28 with ProcessRemark

use of org.asqatasun.entity.audit.ProcessRemark in project Asqatasun by Asqatasun.

the class Rgaa22Rule11071Test method setProcess.

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------1Passed-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("Rgaa22.Test.11.7-1Passed-01");
    // check test result
    assertEquals(TestSolution.PASSED, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------1Passed-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.7-1Passed-02");
    // check test result
    assertEquals(TestSolution.PASSED, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------1Passed-03------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.7-1Passed-03");
    // check test result
    assertEquals(TestSolution.PASSED, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(2, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------1Passed-04------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.7-1Passed-04");
    // check test result
    assertEquals(TestSolution.PASSED, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------2Failed-01------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.7-2Failed-01");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CAPTION_MISSING_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    //----------------------------------------------------------------------
    //------------------------------2Failed-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.7-2Failed-02");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CAPTION_MISSING_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    //----------------------------------------------------------------------
    //------------------------------2Failed-03------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.7-2Failed-03");
    // check number of elements in the page
    assertEquals(2, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(2, processResult.getRemarkSet().size());
    Iterator<ProcessRemark> iter = processResult.getRemarkSet().iterator();
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CAPTION_MISSING_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CAPTION_MISSING_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    //----------------------------------------------------------------------
    //------------------------------2Failed-04------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.7-2Failed-04");
    // check number of elements in the page
    assertEquals(2, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(2, processResult.getRemarkSet().size());
    iter = processResult.getRemarkSet().iterator();
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CAPTION_MISSING_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_WITH_CAPTION_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    //----------------------------------------------------------------------
    //------------------------------2Failed-05------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.7-2Failed-05");
    // check number of elements in the page
    assertEquals(2, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(2, processResult.getRemarkSet().size());
    iter = processResult.getRemarkSet().iterator();
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CAPTION_MISSING_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_WITHOUT_CAPTION_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    //----------------------------------------------------------------------
    //------------------------------2Failed-06------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.7-2Failed-06");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CAPTION_MISSING_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    //----------------------------------------------------------------------
    //------------------------------3NMI-01--------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.7-3NMI-01");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_WITHOUT_CAPTION_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    //----------------------------------------------------------------------
    //------------------------------3NMI-02--------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.7-3NMI-02");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_WITH_CAPTION_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    //----------------------------------------------------------------------
    //------------------------------3NMI-03--------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.7-3NMI-03");
    // check number of elements in the page
    assertEquals(2, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_WITH_CAPTION_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    //----------------------------------------------------------------------
    //------------------------------3NMI-01--------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.7-3NMI-04");
    // check number of elements in the page
    assertEquals(2, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_WITHOUT_CAPTION_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    //----------------------------------------------------------------------
    //------------------------------4NA-01------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.7-4NA-01");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------4NA-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.7-4NA-02");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
}
Also used : LinkedHashSet(java.util.LinkedHashSet) ProcessResult(org.asqatasun.entity.audit.ProcessResult) SourceCodeRemark(org.asqatasun.entity.audit.SourceCodeRemark) ProcessRemark(org.asqatasun.entity.audit.ProcessRemark)

Example 29 with ProcessRemark

use of org.asqatasun.entity.audit.ProcessRemark in project Asqatasun by Asqatasun.

the class Rgaa22Rule05281Test method setProcess.

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------3NMI-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("Rgaa22.Test.5.28-3NMI-01");
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check test has no remark
    assertNotNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(3, processResult.getElementCounter());
    // check type of remarks and their value
    assertNotNull(processResult.getRemarkSet());
    SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
    // check number, type and value of remarks
    assertNotNull(processResult.getRemarkSet());
    assertEquals(3, processResult.getRemarkSet().size());
    for (ProcessRemark remark : processResult.getRemarkSet()) {
        processRemark = (SourceCodeRemark) remark;
        assertEquals(MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
    }
    //----------------------------------------------------------------------
    //------------------------------4NA-01------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.5.28-4NA-01");
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
}
Also used : ProcessResult(org.asqatasun.entity.audit.ProcessResult) SourceCodeRemark(org.asqatasun.entity.audit.SourceCodeRemark) ProcessRemark(org.asqatasun.entity.audit.ProcessRemark)

Example 30 with ProcessRemark

use of org.asqatasun.entity.audit.ProcessRemark in project Asqatasun by Asqatasun.

the class Rgaa22Rule09011Test method setProcess.

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------1Passed-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("Rgaa22.Test.9.1-1Passed-01");
    // check test result
    assertEquals(TestSolution.PASSED, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page (no counter management here, 
    // we test the presence of one tag in the page)
    assertEquals(0, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------2Failed-01------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.9.1-2Failed-01");
    // check number of elements in the page (no counter management here, 
    // we test the presence of one tag in the page)
    assertEquals(0, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    ProcessRemark processRemark = ((ProcessRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(RemarkMessageStore.DOCTYPE_MISSING_MSG, processRemark.getMessageCode());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
}
Also used : ProcessResult(org.asqatasun.entity.audit.ProcessResult) ProcessRemark(org.asqatasun.entity.audit.ProcessRemark)

Aggregations

ProcessRemark (org.asqatasun.entity.audit.ProcessRemark)56 ProcessResult (org.asqatasun.entity.audit.ProcessResult)41 SourceCodeRemark (org.asqatasun.entity.audit.SourceCodeRemark)31 LinkedHashSet (java.util.LinkedHashSet)23 ElementHandlerImpl (org.asqatasun.ruleimplementation.ElementHandlerImpl)6 TestSolutionHandler (org.asqatasun.ruleimplementation.TestSolutionHandler)6 TestSolutionHandlerImpl (org.asqatasun.ruleimplementation.TestSolutionHandlerImpl)6 Element (org.jsoup.nodes.Element)6 ProcessRemarkService (org.asqatasun.service.ProcessRemarkService)5 EvidenceElement (org.asqatasun.entity.audit.EvidenceElement)4