Search in sources :

Example 76 with SourceCodeRemark

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

the class Aw22Rule09014Test method setProcess.

@Override
protected void setProcess() {
    // ----------------------------------------------------------------------
    // ------------------------------2Failed-01------------------------------
    // ----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.9.1.4-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("Aw22 Test.9.1.4 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("AW22.Test.9.1.4-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("Aw22 Test.9.1.4 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("AW22.Test.9.1.4-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 77 with SourceCodeRemark

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

the class Aw22Rule08041Test method setProcess.

@Override
protected void setProcess() {
    // ----------------------------------------------------------------------
    // ---------------------------1Passed-01---------------------------------
    // ----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.8.4.1-1Passed-01");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.PASSED, processResult.getValue());
    // check number of remarks and their value
    assertNull(processResult.getRemarkSet());
    // ----------------------------------------------------------------------
    // ---------------------------1Passed-02---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.8.4.1-1Passed-02");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.PASSED, processResult.getValue());
    // check number of remarks and their value
    assertNull(processResult.getRemarkSet());
    // ----------------------------------------------------------------------
    // ---------------------------1Passed-03---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.8.4.1-1Passed-03");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.PASSED, processResult.getValue());
    // check number of remarks and their value
    assertNull(processResult.getRemarkSet());
    // ----------------------------------------------------------------------
    // ---------------------------2Failed-01---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.8.4.1-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.WRONG_LANGUAGE_DECLARATION_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.HTML_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    Iterator<EvidenceElement> pIter = processRemark.getElementList().iterator();
    EvidenceElement ee = pIter.next();
    assertEquals("aq", ee.getValue());
    assertEquals(EvidenceStore.LANGUAGE_EE, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ---------------------------2Failed-02---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.8.4.1-2Failed-02");
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // 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.WRONG_LANGUAGE_DECLARATION_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.HTML_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    pIter = processRemark.getElementList().iterator();
    ee = pIter.next();
    assertEquals("aq", ee.getValue());
    assertEquals(EvidenceStore.LANGUAGE_EE, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ---------------------------2Failed-03---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.8.4.1-2Failed-03");
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // 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.MALFORMED_LANGUAGE_DECLARATION_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.HTML_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    pIter = processRemark.getElementList().iterator();
    ee = pIter.next();
    assertEquals("en-U", ee.getValue());
    assertEquals(EvidenceStore.LANGUAGE_EE, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ---------------------------2Failed-04---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.8.4.1-2Failed-04");
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // 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.MALFORMED_LANGUAGE_DECLARATION_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.HTML_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    pIter = processRemark.getElementList().iterator();
    ee = pIter.next();
    assertEquals("english", ee.getValue());
    assertEquals(EvidenceStore.LANGUAGE_EE, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ---------------------------2Failed-05---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.8.4.1-2Failed-05");
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // 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.IRRELEVANT_LANG_DECL_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.HTML_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(3, processRemark.getElementList().size());
    pIter = processRemark.getElementList().iterator();
    ee = pIter.next();
    assertEquals("ro", ee.getValue());
    assertEquals(EvidenceStore.LANGUAGE_EE, ee.getEvidence().getCode());
    ee = pIter.next();
    assertEquals("en", ee.getValue());
    assertEquals(EvidenceStore.DETECTED_LANGUAGE_EE, ee.getEvidence().getCode());
    ee = pIter.next();
    assertTrue(ee.getValue().contains("AW22 Test.8.4.1 Failed 05 AW22 Test.8.4.1 Failed 05 Failed : the default language is defined on the html tag but its"));
    assertEquals(EvidenceStore.EXTRACTED_TEXT_EE, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ---------------------------2Failed-06---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.8.4.1-2Failed-06");
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // 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.MALFORMED_LANGUAGE_DECLARATION_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.HTML_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    pIter = processRemark.getElementList().iterator();
    ee = pIter.next();
    assertEquals("en;US", ee.getValue());
    assertEquals(EvidenceStore.LANGUAGE_EE, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ---------------------------3NMI-01------------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.8.4.1-3NMI-01");
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // 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.SUSPECTED_IRRELEVANT_LANG_DECL_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.HTML_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    // check number of evidence elements and their value
    assertEquals(3, processRemark.getElementList().size());
    pIter = processRemark.getElementList().iterator();
    ee = pIter.next();
    assertEquals("de", ee.getValue());
    assertEquals(EvidenceStore.LANGUAGE_EE, ee.getEvidence().getCode());
    ee = pIter.next();
    assertEquals("en", ee.getValue());
    assertEquals(EvidenceStore.DETECTED_LANGUAGE_EE, ee.getEvidence().getCode());
    ee = pIter.next();
    assertTrue(ee.getValue().contains("AW22 Test.8.4.1 NMI 01 AW22 Test.8.4.1 NMI 01"));
    assertEquals(EvidenceStore.EXTRACTED_TEXT_EE, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ---------------------------3NMI-02------------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.8.4.1-3NMI-02");
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // 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.SUSPECTED_RELEVANT_LANG_DECL_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.HTML_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(3, processRemark.getElementList().size());
    pIter = processRemark.getElementList().iterator();
    ee = pIter.next();
    assertEquals("en", ee.getValue());
    assertEquals(EvidenceStore.LANGUAGE_EE, ee.getEvidence().getCode());
    ee = pIter.next();
    assertEquals("en", ee.getValue());
    assertEquals(EvidenceStore.DETECTED_LANGUAGE_EE, ee.getEvidence().getCode());
    ee = pIter.next();
    assertTrue(ee.getValue().contains("Some short text in english"));
    assertEquals(EvidenceStore.EXTRACTED_TEXT_EE, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ---------------------------4NA-01-------------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.8.4.1-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 78 with SourceCodeRemark

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

the class Aw22Rule08061Test method setProcess.

@Override
protected void setProcess() {
    // ----------------------------------------------------------------------
    // ------------------------------2Failed-01------------------------------
    // ----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.8.6.1-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.NOT_PERTINENT_TITLE_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.TITLE_ELEMENT, processRemark.getTarget());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    Iterator<EvidenceElement> pIter = processRemark.getElementList().iterator();
    EvidenceElement ee = pIter.next();
    assertEquals("Page title", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ------------------------------2Failed-02------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.8.6.1-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.NOT_PERTINENT_TITLE_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.TITLE_ELEMENT, processRemark.getTarget());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    pIter = processRemark.getElementList().iterator();
    ee = pIter.next();
    assertEquals("", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ------------------------------2Failed-03------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.8.6.1-2Failed-03");
    // 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.NOT_PERTINENT_TITLE_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.TITLE_ELEMENT, processRemark.getTarget());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    pIter = processRemark.getElementList().iterator();
    ee = pIter.next();
    assertEquals("Bienvenue dans Adobe GoLive 6", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-01------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.8.6.1-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_TITLE_PERTINENCE_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.TITLE_ELEMENT, processRemark.getTarget());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    pIter = processRemark.getElementList().iterator();
    ee = pIter.next();
    assertEquals("AW22 Test.8.6.1 NMI 01", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ------------------------------4NA-01----------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.8.6.1-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 79 with SourceCodeRemark

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

the class Aw22Rule07051Test method setProcess.

@Override
protected void setProcess() {
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-01---------------------------------
    // ----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.07.05.01-3NMI-01");
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    assertTrue(processResult.getRemarkSet().iterator().next() instanceof ProcessRemark);
    assertEquals(getMessageKey(RemarkMessageStore.NO_PATTERN_DETECTED_MSG), processResult.getRemarkSet().iterator().next().getMessageCode());
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-02---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.07.05.01-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());
    Iterator<ProcessRemark> iter = processResult.getRemarkSet().iterator();
    SourceCodeRemark processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CONTEXT_CHANGED_SCRIPT_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.SELECT_ELEMENT, processRemark.getTarget());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-03---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.07.05.01-3NMI-03");
    // 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());
    iter = processResult.getRemarkSet().iterator();
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CONTEXT_CHANGED_SCRIPT_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.FORM_ELEMENT, processRemark.getTarget());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-04---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.07.05.01-3NMI-04");
    // 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());
    iter = processResult.getRemarkSet().iterator();
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CONTEXT_CHANGED_SCRIPT_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.SELECT_ELEMENT, processRemark.getTarget());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-05---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.07.05.01-3NMI-05");
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    assertTrue(processResult.getRemarkSet().iterator().next() instanceof ProcessRemark);
    assertEquals(getMessageKey(RemarkMessageStore.NO_PATTERN_DETECTED_MSG), processResult.getRemarkSet().iterator().next().getMessageCode());
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-06---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.07.05.01-3NMI-06");
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    assertTrue(processResult.getRemarkSet().iterator().next() instanceof ProcessRemark);
    assertEquals(getMessageKey(RemarkMessageStore.NO_PATTERN_DETECTED_MSG), processResult.getRemarkSet().iterator().next().getMessageCode());
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-07---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.07.05.01-3NMI-07");
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    assertTrue(processResult.getRemarkSet().iterator().next() instanceof ProcessRemark);
    assertEquals(getMessageKey(RemarkMessageStore.NO_PATTERN_DETECTED_MSG), processResult.getRemarkSet().iterator().next().getMessageCode());
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-08---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.07.05.01-3NMI-08");
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    assertTrue(processResult.getRemarkSet().iterator().next() instanceof ProcessRemark);
    assertEquals(getMessageKey(RemarkMessageStore.NO_PATTERN_DETECTED_MSG), processResult.getRemarkSet().iterator().next().getMessageCode());
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-09---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.07.05.01-3NMI-09");
    // 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(2, processResult.getRemarkSet().size());
    iter = processResult.getRemarkSet().iterator();
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CONTEXT_CHANGED_SCRIPT_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.FORM_ELEMENT, processRemark.getTarget());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CONTEXT_CHANGED_SCRIPT_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.SELECT_ELEMENT, processRemark.getTarget());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
}
Also used : ProcessResult(org.asqatasun.entity.audit.ProcessResult) SourceCodeRemark(org.asqatasun.entity.audit.SourceCodeRemark) ProcessRemark(org.asqatasun.entity.audit.ProcessRemark)

Example 80 with SourceCodeRemark

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

the class Aw22Rule06051Test method setProcess.

@Override
protected void setProcess() {
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-01---------------------------------
    // ----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.6.5.1-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());
    SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.IMG_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    EvidenceElement ee = processRemark.getElementList().iterator().next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image.jpg"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-02---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.6.5.1-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.MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.INPUT_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image.jpg"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ------------------------------4NA-01---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.6.5.1-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-01----------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.6.5.1-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) EvidenceElement(org.asqatasun.entity.audit.EvidenceElement) ProcessResult(org.asqatasun.entity.audit.ProcessResult) SourceCodeRemark(org.asqatasun.entity.audit.SourceCodeRemark)

Aggregations

SourceCodeRemark (org.asqatasun.entity.audit.SourceCodeRemark)148 ProcessResult (org.asqatasun.entity.audit.ProcessResult)143 LinkedHashSet (java.util.LinkedHashSet)73 EvidenceElement (org.asqatasun.entity.audit.EvidenceElement)53 ProcessRemark (org.asqatasun.entity.audit.ProcessRemark)31