Search in sources :

Example 66 with SourceCodeRemark

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

the class Rgaa22Rule11071Test method setProcess.

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

Example 67 with SourceCodeRemark

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

the class Rgaa22Rule11091Test method setProcess.

@Override
protected void setProcess() {
    // ----------------------------------------------------------------------
    // ------------------------------2Failed-01------------------------------
    // ----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("Rgaa22.Test.11.9-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_CAPTION_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.CAPTION_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    EvidenceElement ee = processRemark.getElementList().iterator().next();
    assertEquals("", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ------------------------------2Failed-02------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.9-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_CAPTION_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.CAPTION_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertEquals("!:;,--><--", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ------------------------------2Failed-03------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.9-2Failed-03");
    // check number of elements in the page
    assertEquals(4, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(4, processResult.getRemarkSet().size());
    Iterator<ProcessRemark> iter = processResult.getRemarkSet().iterator();
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(RemarkMessageStore.NOT_PERTINENT_CAPTION_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.CAPTION_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertEquals("!:;,--><--", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CHECK_CAPTION_PERTINENCE_FOR_DATA_TABLE_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.CAPTION_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertEquals("Caption of data table", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_FOR_NOT_PERTINENT_CAPTION_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.CAPTION_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertEquals("", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_AND_CAPTION_PERTINENCE_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.CAPTION_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertEquals("Caption of unidentified table", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-01--------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.9-3NMI-01");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_AND_CAPTION_PERTINENCE_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.CAPTION_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertEquals("Title of the test table", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-02--------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.9-3NMI-02");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CHECK_CAPTION_PERTINENCE_FOR_DATA_TABLE_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.CAPTION_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertEquals("Caption of data table", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-03--------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.9-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());
    processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_FOR_NOT_PERTINENT_CAPTION_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.CAPTION_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertEquals("", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-04---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.9-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());
    processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_AND_CAPTION_PERTINENCE_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.CAPTION_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertEquals("Caption of unidentified table", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-05------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.9-3NMI-05");
    // check number of elements in the page
    assertEquals(3, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(3, processResult.getRemarkSet().size());
    iter = processResult.getRemarkSet().iterator();
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CHECK_CAPTION_PERTINENCE_FOR_DATA_TABLE_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.CAPTION_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertEquals("Caption of data table", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_FOR_NOT_PERTINENT_CAPTION_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.CAPTION_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertEquals("", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_TABLE_AND_CAPTION_PERTINENCE_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.CAPTION_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertEquals("Caption of unidentified table", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ------------------------------4NA-01------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.9-4NA-01");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    // ----------------------------------------------------------------------
    // ------------------------------4NA-02------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.9-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());
    // ----------------------------------------------------------------------
    // ------------------------------4NA-03----------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.9-4NA-03");
    // 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-04----------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.11.9-4NA-04");
    // 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) ProcessRemark(org.asqatasun.entity.audit.ProcessRemark)

Example 68 with SourceCodeRemark

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

the class Rgaa22Rule11081Test method setProcess.

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

Example 69 with SourceCodeRemark

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

the class SeoRule02011Test method setProcess.

@Override
protected void setProcess() {
    // ----------------------------------------------------------------------
    // ------------------------------1Passed-01------------------------------
    // ----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("Seo.Test.2.1.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("Seo.Test.2.1.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());
    // ----------------------------------------------------------------------
    // ------------------------------2Failed-01------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Seo.Test.2.1.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) processResult.getRemarkSet().iterator().next();
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(RemarkMessageStore.ALT_MISSING_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(ee.getValue().contains("my-image.jpg"));
    assertEquals(AttributeStore.SRC_ATTR, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ------------------------------2Failed-02------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Seo.Test.2.1.1-2Failed-02");
    // check number of elements in the page
    assertEquals(2, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    processRemark = (SourceCodeRemark) processResult.getRemarkSet().iterator().next();
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(RemarkMessageStore.ALT_MISSING_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());
    ee = processRemark.getElementList().iterator().next();
    assertTrue(ee.getValue().contains("my-image2.jpg"));
    assertEquals(AttributeStore.SRC_ATTR, ee.getEvidence().getCode());
    // ----------------------------------------------------------------------
    // ------------------------------4NA-01---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Seo.Test.2.1.1-4NA-01");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
    // ----------------------------------------------------------------------
    // ------------------------------4NA-02---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Seo.Test.2.1.1-4NA-02");
    // 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 70 with SourceCodeRemark

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

the class SeoRule07013Test method setProcess.

@Override
protected void setProcess() {
    // ----------------------------------------------------------------------
    // ------------------------------2Failed-01------------------------------
    // ----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("Seo.Test.7.1.3-2Failed-01");
    // check number of elements in the page
    assertEquals(25, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(25, 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("Seo Test.7.1.3 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();
    assertEquals("1234685423", 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();
    assertEquals("121546842331", 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();
    assertEquals("2111224654348751", 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();
    assertEquals("12125454352321", 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();
    assertEquals("1223415246855", 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();
    assertEquals("12354643321231545", 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("Seo.Test.7.1.3-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("Seo Test.7.1.3 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("Seo.Test.7.1.3-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)

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