コード例 #1
0
ファイル: Rgaa22Rule03121Test.java プロジェクト: e0d/Tanaguru
  @Override
  protected void setProcess() {
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-01------------------------------
    // ----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("Rgaa22.Test.3.12-3NMI-01");
    // 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());
    Iterator<ProcessRemark> pIter = processResult.getRemarkSet().iterator();

    SourceCodeRemark processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_LABEL_PERTINENCE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.LABEL_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    Iterator<EvidenceElement> iter = processRemark.getElementList().iterator();
    EvidenceElement ee = iter.next();
    assertEquals("", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = iter.next();
    assertEquals("attribute-absent", ee.getValue());
    assertEquals(TITLE_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_LABEL_PERTINENCE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.LABEL_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    iter = processRemark.getElementList().iterator();
    ee = iter.next();
    assertEquals("Input label", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = iter.next();
    assertEquals("", ee.getValue());
    assertEquals(TITLE_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_LABEL_PERTINENCE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.LABEL_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(2, processRemark.getElementList().size());
    iter = processRemark.getElementList().iterator();
    ee = iter.next();
    assertEquals("", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = iter.next();
    assertEquals("Input label", ee.getValue());
    assertEquals(TITLE_ATTR, ee.getEvidence().getCode());

    // ----------------------------------------------------------------------
    // ------------------------------4NA-01----------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.3.12-4NA-01");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());

    // ----------------------------------------------------------------------
    // ------------------------------4NA-02----------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa22.Test.3.12-4NA-02");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
  }
コード例 #2
0
ファイル: Aw22Rule05021Test.java プロジェクト: e0d/Tanaguru
  @Override
  protected void setProcess() {
    // ----------------------------------------------------------------------
    // ------------------------------2Failed-01------------------------------
    // ----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.5.2.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_SUMMARY_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_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(SUMMARY_ATTR, ee.getEvidence().getCode());

    // ----------------------------------------------------------------------
    // ------------------------------2Failed-02------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.5.2.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_SUMMARY_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_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(SUMMARY_ATTR, ee.getEvidence().getCode());

    // ----------------------------------------------------------------------
    // ------------------------------2Failed-03------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.5.2.1-2Failed-03");
    // check number of elements in the page
    assertEquals(3, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(3, processResult.getRemarkSet().size());
    Iterator<ProcessRemark> iter = processResult.getRemarkSet().iterator();

    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(RemarkMessageStore.NOT_PERTINENT_SUMMARY_MSG, processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_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(SUMMARY_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(
        RemarkMessageStore.CHECK_NATURE_OF_TABLE_AND_SUMMARY_PERTINENCE_MSG,
        processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertEquals("Summary of table without marker", ee.getValue());
    assertEquals(SUMMARY_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(
        RemarkMessageStore.CHECK_NATURE_OF_TABLE_FOR_NOT_PERTINENT_SUMMARY_MSG,
        processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_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(SUMMARY_ATTR, ee.getEvidence().getCode());

    // ----------------------------------------------------------------------
    // ------------------------------3NMI-01--------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.5.2.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_NATURE_OF_TABLE_AND_SUMMARY_PERTINENCE_MSG,
        processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertEquals("Summary of not identified table", ee.getValue());
    assertEquals(SUMMARY_ATTR, ee.getEvidence().getCode());

    // ----------------------------------------------------------------------
    // ------------------------------3NMI-02--------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.5.2.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.CHECK_SUMMARY_PERTINENCE_FOR_DATA_TABLE_MSG,
        processRemark.getMessageCode());
    assertTrue(processRemark.getTarget().equalsIgnoreCase(HtmlElementStore.TABLE_ELEMENT));
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertEquals("Summary of data table", ee.getValue());
    assertEquals(SUMMARY_ATTR, ee.getEvidence().getCode());

    // ----------------------------------------------------------------------
    // ------------------------------4NA-01----------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.5.2.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-02----------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.5.2.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());

    // ----------------------------------------------------------------------
    // ------------------------------4NA-03----------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.5.2.1-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());
  }