Search in sources :

Example 31 with EvidenceElement

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

the class Rgaa22Rule10021Test method setProcess.

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------2Failed-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("RGAA22.Test.10.2-2Failed-01");
    // check number of elements in the page
    assertEquals(19, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(19, processResult.getRemarkSet().size());
    Iterator<SourceCodeRemark> iter = ((LinkedHashSet) processResult.getRemarkSet()).iterator();
    //----------------------------------------------------------------------
    SourceCodeRemark processRemark = iter.next();
    assertEquals(RemarkMessageStore.CHECK_HEADING_PERTINENCE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.H1_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    Iterator<EvidenceElement> eIter = processRemark.getElementList().iterator();
    EvidenceElement ee = eIter.next();
    assertEquals("Rgaa22 Test.10.2 Failed 01", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_HEADING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.H1_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertTrue(StringUtils.isEmpty(ee.getValue()));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_HEADING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.H1_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertEquals("!:;,&~$*/-*/-*", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_HEADING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.H1_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertTrue(StringUtils.isEmpty(ee.getValue()));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_HEADING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.H2_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertTrue(StringUtils.isEmpty(ee.getValue()));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_HEADING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.H2_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertEquals("!:;,&~$*/-*/-*", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_HEADING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.H2_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertTrue(StringUtils.isEmpty(ee.getValue()));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_HEADING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.H3_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertTrue(StringUtils.isEmpty(ee.getValue()));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_HEADING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.H3_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertEquals("!:;,&~$*/-*/-*", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_HEADING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.H3_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertTrue(StringUtils.isEmpty(ee.getValue()));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_HEADING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.H4_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertTrue(StringUtils.isEmpty(ee.getValue()));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_HEADING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.H4_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertEquals("!:;,&~$*/-*/-*", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_HEADING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.H4_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertTrue(StringUtils.isEmpty(ee.getValue()));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_HEADING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.H5_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertTrue(StringUtils.isEmpty(ee.getValue()));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_HEADING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.H5_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertEquals("!:;,&~$*/-*/-*", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_HEADING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.H5_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertTrue(StringUtils.isEmpty(ee.getValue()));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_HEADING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.H6_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertTrue(StringUtils.isEmpty(ee.getValue()));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_HEADING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.H6_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertEquals("!:;,&~$*/-*/-*", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_HEADING_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.H6_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertTrue(StringUtils.isEmpty(ee.getValue()));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    //------------------------------3NMI-01---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("RGAA22.Test.10.2-3NMI-01");
    // check number of elements in the page
    assertEquals(13, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(13, processResult.getRemarkSet().size());
    iter = ((LinkedHashSet) processResult.getRemarkSet()).iterator();
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.CHECK_HEADING_PERTINENCE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.H1_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertEquals("Rgaa22 Test.10.2 NMI 01", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.CHECK_HEADING_PERTINENCE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.H1_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertEquals("Title level 1-1", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.CHECK_HEADING_PERTINENCE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.H1_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertEquals("Title level 1-2", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.CHECK_HEADING_PERTINENCE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.H2_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertEquals("Title level 2-1", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.CHECK_HEADING_PERTINENCE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.H2_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertEquals("Title level 2-2", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.CHECK_HEADING_PERTINENCE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.H3_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertEquals("Title level 3-1", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.CHECK_HEADING_PERTINENCE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.H3_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertEquals("Title level 3-2", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.CHECK_HEADING_PERTINENCE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.H4_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertEquals("Title level 4-1", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.CHECK_HEADING_PERTINENCE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.H4_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertEquals("Title level 4-2", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.CHECK_HEADING_PERTINENCE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.H5_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertEquals("Title level 5-1", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.CHECK_HEADING_PERTINENCE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.H5_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertEquals("Title level 5-2", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.CHECK_HEADING_PERTINENCE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.H6_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertEquals("Title level 6-1", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    processRemark = iter.next();
    assertEquals(RemarkMessageStore.CHECK_HEADING_PERTINENCE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.H6_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    eIter = processRemark.getElementList().iterator();
    ee = eIter.next();
    assertEquals("Title level 6-2", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = eIter.next();
    assertEquals("headings", ee.getValue());
    assertEquals(ProcessRemarkService.DEFAULT_EVIDENCE, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    //------------------------------4NA-01----------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("RGAA22.Test.10.2-4NA-01");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
}
Also used : LinkedHashSet(java.util.LinkedHashSet) EvidenceElement(org.asqatasun.entity.audit.EvidenceElement) ProcessResult(org.asqatasun.entity.audit.ProcessResult) SourceCodeRemark(org.asqatasun.entity.audit.SourceCodeRemark)

Example 32 with EvidenceElement

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

the class Rgaa22Rule10111Test method setProcess.

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------3NMI-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("Rgaa22.Test.10.11-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(1, 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 evidence elements
    assertEquals(2, processRemark.getElementList().size());
    Iterator<EvidenceElement> iterator = processRemark.getElementList().iterator();
    EvidenceElement ee = iterator.next();
    assertEquals(TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = iterator.next();
    assertEquals(TITLE_ATTR, ee.getEvidence().getCode());
    //----------------------------------------------------------------------
    //------------------------------4NA-01------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.10.11-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());
    //----------------------------------------------------------------------
    //------------------------------4NA-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.10.11-4NA-02");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
}
Also used : EvidenceElement(org.asqatasun.entity.audit.EvidenceElement) ProcessResult(org.asqatasun.entity.audit.ProcessResult) SourceCodeRemark(org.asqatasun.entity.audit.SourceCodeRemark)

Example 33 with EvidenceElement

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

the class AbstractPageRuleCssImplementation method addCssOnErrorRemarks.

/**
     * Each not adapted css generates a process remark to indicate that 
     * some selectors haven't been tested
     * 
     * @param styleSheetsOnError
     * @param testSolutionHandler
     * @param processRemarkService
     */
private void addCssOnErrorRemarks(Collection<StylesheetContent> styleSheetsOnError, TestSolutionHandler testSolutionHandler, ProcessRemarkService processRemarkService) {
    for (StylesheetContent stylesheetContent : styleSheetsOnError) {
        List<EvidenceElement> evidenceElementList = new ArrayList<EvidenceElement>();
        evidenceElementList.add(processRemarkService.getEvidenceElement(ProcessRemarkService.DEFAULT_EVIDENCE, stylesheetContent.getURI()));
        processRemarkService.addSourceCodeRemarkOnElement(TestSolution.NEED_MORE_INFO, null, UNTESTED_RESOURCE_MSG_CODE, evidenceElementList);
    }
    testSolutionHandler.addTestSolution(TestSolution.NEED_MORE_INFO);
}
Also used : StylesheetContent(org.asqatasun.entity.audit.StylesheetContent) EvidenceElement(org.asqatasun.entity.audit.EvidenceElement) ArrayList(java.util.ArrayList)

Example 34 with EvidenceElement

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

the class EvidenceElementFactoryImpl method create.

@Override
public EvidenceElement create(ProcessRemark processRemark, String value, Evidence evidence) {
    EvidenceElement evidenceElement = create();
    evidenceElement.setProcessRemark(processRemark);
    evidenceElement.setValue(value);
    evidenceElement.setEvidence(evidence);
    return evidenceElement;
}
Also used : EvidenceElement(org.asqatasun.entity.audit.EvidenceElement)

Example 35 with EvidenceElement

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

the class EvidenceElementFactoryImpl method create.

@Override
public EvidenceElement create(String value, Evidence evidence) {
    EvidenceElement evidenceElement = create();
    evidenceElement.setValue(value);
    evidenceElement.setEvidence(evidence);
    return evidenceElement;
}
Also used : EvidenceElement(org.asqatasun.entity.audit.EvidenceElement)

Aggregations

EvidenceElement (org.asqatasun.entity.audit.EvidenceElement)68 ProcessResult (org.asqatasun.entity.audit.ProcessResult)53 SourceCodeRemark (org.asqatasun.entity.audit.SourceCodeRemark)53 LinkedHashSet (java.util.LinkedHashSet)22 ProcessRemark (org.asqatasun.entity.audit.ProcessRemark)4 ArrayList (java.util.ArrayList)3 DomElement (org.asqatasun.rules.domelement.DomElement)2 Element (org.jsoup.nodes.Element)2 CascadingStyleSheet (com.phloc.css.decl.CascadingStyleSheet)1 File (java.io.File)1 IOException (java.io.IOException)1 CSSParserExceptionHandlerImpl (org.asqatasun.contentadapter.css.CSSParserExceptionHandlerImpl)1 StylesheetContent (org.asqatasun.entity.audit.StylesheetContent)1 TestSolution (org.asqatasun.entity.audit.TestSolution)1 ContrastCheckerParseResultException (org.asqatasun.rules.elementchecker.contrast.exception.ContrastCheckerParseResultException)1