Example usage for org.apache.commons.lang3 StringUtils contains

List of usage examples for org.apache.commons.lang3 StringUtils contains

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils contains.

Prototype

public static boolean contains(final CharSequence seq, final CharSequence searchSeq) 

Source Link

Document

Checks if CharSequence contains a search CharSequence, handling null .

Usage

From source file:org.asqatasun.rules.accessiweb22.Aw22Rule01023Test.java

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------1Passed-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.1.2.3-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("AW22.Test.1.2.3-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("AW22.Test.1.2.3-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(1, processResult.getElementCounter());

    //----------------------------------------------------------------------
    //------------------------------1Passed-04------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.3-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(3, processResult.getElementCounter());

    //----------------------------------------------------------------------
    //------------------------------1Passed-05------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.3-1Passed-05");
    // 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("AW22.Test.1.2.3-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());//w w w. j  av  a  2s .c  o m
    assertEquals(RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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();
    assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt"));
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.3-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(RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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();
    assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt"));
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-03------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.3-2Failed-03");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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();
    assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt"));
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-04------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.3-2Failed-04");
    // 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> pIter = processResult.getRemarkSet().iterator();

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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();
    assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt"));
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock1.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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();
    assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt"));
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock2.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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();
    assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt"));
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock3.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-05------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.3-2Failed-05");
    // 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(RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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();
    assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt"));
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock1.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-01---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.3-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(RemarkMessageStore.CHECK_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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();
    assertTrue(StringUtils.contains(ee.getValue(), ""));
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-02---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.3-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(RemarkMessageStore.CHECK_ELEMENT_WITH_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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();
    assertTrue(StringUtils.contains(ee.getValue(), ""));
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-03---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.3-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(RemarkMessageStore.CHECK_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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();
    assertTrue(StringUtils.contains(ee.getValue(), ""));
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock1.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-04---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.3-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(RemarkMessageStore.CHECK_ELEMENT_WITH_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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();
    assertTrue(StringUtils.contains(ee.getValue(), ""));
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock1.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-05---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.3-3NMI-05");
    // 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(RemarkMessageStore.CHECK_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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();
    assertTrue(StringUtils.contains(ee.getValue(), ""));
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock1.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-06---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.3-3NMI-06");
    // 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(RemarkMessageStore.CHECK_ELEMENT_WITH_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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();
    assertTrue(StringUtils.contains(ee.getValue(), ""));
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock1.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

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

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

From source file:org.asqatasun.rules.accessiweb22.Aw22Rule01024Test.java

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------1Passed-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.1.2.4-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("AW22.Test.1.2.4-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("AW22.Test.1.2.4-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(1, processResult.getElementCounter());

    //----------------------------------------------------------------------
    //------------------------------1Passed-04------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.4-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(3, processResult.getElementCounter());

    //----------------------------------------------------------------------
    //------------------------------1Passed-05------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.4-1Passed-05");
    // 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("AW22.Test.1.2.4-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());/*from w ww.j  ava2  s. c o  m*/
    assertEquals(RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.OBJECT_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();
    assertTrue(StringUtils.contains(ee.getValue(), "Not empty alternative"));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_image.gif"));
    assertEquals(DATA_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.4-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(RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.OBJECT_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();
    assertTrue(StringUtils.contains(ee.getValue(), "Not empty alternative"));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_image.gif"));
    assertEquals(DATA_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-03------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.4-2Failed-03");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.OBJECT_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();
    assertTrue(StringUtils.contains(ee.getValue(), "Not empty alternative"));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_image.gif"));
    assertEquals(DATA_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-04------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.4-2Failed-04");
    // 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> pIter = processResult.getRemarkSet().iterator();

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.OBJECT_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();
    assertTrue(StringUtils.contains(ee.getValue(), "Not empty alternative"));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_image1.gif"));
    assertEquals(DATA_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.OBJECT_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();
    assertTrue(StringUtils.contains(ee.getValue(), "Not empty alternative"));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_image2.gif"));
    assertEquals(DATA_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.OBJECT_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();
    assertTrue(StringUtils.contains(ee.getValue(), "Not empty alternative"));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_image3.gif"));
    assertEquals(DATA_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-05------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.4-2Failed-05");
    // 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(RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.OBJECT_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();
    assertTrue(StringUtils.contains(ee.getValue(), "Not empty alternative"));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_image1.gif"));
    assertEquals(DATA_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-01---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.4-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(RemarkMessageStore.CHECK_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.OBJECT_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();
    assertTrue(StringUtils.contains(ee.getValue(), ""));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_image.gif"));
    assertEquals(DATA_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-02---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.4-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(RemarkMessageStore.CHECK_ELEMENT_WITH_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.OBJECT_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();
    assertTrue(StringUtils.contains(ee.getValue(), ""));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_image.gif"));
    assertEquals(DATA_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-03---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.4-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(RemarkMessageStore.CHECK_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.OBJECT_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();
    assertTrue(StringUtils.contains(ee.getValue(), ""));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_image1.gif"));
    assertEquals(DATA_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-04---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.4-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(RemarkMessageStore.CHECK_ELEMENT_WITH_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.OBJECT_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();
    assertTrue(StringUtils.contains(ee.getValue(), ""));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_image1.gif"));
    assertEquals(DATA_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-05---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.4-3NMI-05");
    // 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(RemarkMessageStore.CHECK_ELEMENT_WITH_NOT_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.OBJECT_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();
    assertTrue(StringUtils.contains(ee.getValue(), ""));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_image1.gif"));
    assertEquals(DATA_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-06---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.4-3NMI-06");
    // 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(RemarkMessageStore.CHECK_ELEMENT_WITH_EMPTY_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.OBJECT_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();
    assertTrue(StringUtils.contains(ee.getValue(), ""));
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_image1.gif"));
    assertEquals(DATA_ATTR, ee.getEvidence().getCode());

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

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

From source file:org.asqatasun.rules.accessiweb22.Aw22Rule01025Test.java

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------3NMI-01---------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.1.2.5-3NMI-01");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet())
            .iterator().next());/*from  ww  w.j  a  v a2  s. c  om*/
    assertEquals(RemarkMessageStore.CHECK_ALTERNATIVE_OF_DECORATIVE_ELEMENT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.EMBED_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    EvidenceElement ee = processRemark.getElementList().iterator().next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_embed_object"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-02---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.5-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(RemarkMessageStore.CHECK_NATURE_AND_ALTERNATIVE_OF_ELEMENT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.EMBED_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_embed_object"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-03---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.2.5-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(2, processResult.getRemarkSet().size());
    Iterator<ProcessRemark> iter = processResult.getRemarkSet().iterator();

    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(RemarkMessageStore.CHECK_ALTERNATIVE_OF_DECORATIVE_ELEMENT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.EMBED_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_embed_object1"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(RemarkMessageStore.CHECK_NATURE_AND_ALTERNATIVE_OF_ELEMENT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.EMBED_ELEMENT, processRemark.getTarget());
    assertNotNull(processRemark.getSnippet());
    // check number of evidence elements and their value
    assertEquals(1, processRemark.getElementList().size());
    ee = processRemark.getElementList().iterator().next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_embed_object2"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

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

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

From source file:org.asqatasun.rules.accessiweb22.Aw22Rule01031Test.java

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------2Failed-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.1.3.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());//from  w w w  .j  av  a  2  s. c  o  m
    assertEquals(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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("mock-image", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.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(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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("image.gif", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-03------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.1-2Failed-03");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image.jpg"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-04------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.1-2Failed-04");
    // 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(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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("mock-image", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "images/mock-image"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-05------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.1-2Failed-05");
    // 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(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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("image.bmp", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-06------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.1-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(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image.jpg"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-07------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.1-2Failed-07");
    // 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(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image.jpg"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-08------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.1-2Failed-08");
    // 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(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image.jpg"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-09------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.1-2Failed-09");
    // 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> pIter = processResult.getRemarkSet().iterator();

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image1.jpg"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_ALT_PERTINENCE_OF_INFORMATIVE_IMG_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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("Informative image alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image2.jpg"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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("mock-image3", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image3"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_AND_ALT_PERTINENCE_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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("not identified image alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image4.jpg"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-01------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.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(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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("mock-image", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "images/mock-image"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.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(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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("image.bmp", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-03------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.1-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(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image.jpg"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-04------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.1-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(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image.jpg"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-05---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.1-3NMI-05");
    // 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(RemarkMessageStore.CHECK_ALT_PERTINENCE_OF_INFORMATIVE_IMG_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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("Informative image alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image.jpg"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-06---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.1-3NMI-06");
    // 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(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_AND_ALT_PERTINENCE_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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("Not identified image alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image.jpg"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-07---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.1-3NMI-07");
    // 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());
    pIter = processResult.getRemarkSet().iterator();

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_ALT_PERTINENCE_OF_INFORMATIVE_IMG_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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("Informative image alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image2.jpg"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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("mock-image3", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image3"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_AND_ALT_PERTINENCE_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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("not identified image alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image4.jpg"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

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

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

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

From source file:org.asqatasun.rules.accessiweb22.Aw22Rule01032Test.java

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------2Failed-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.1.3.2-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());// w  w w.  j a v  a  2 s  .  c o m
    assertEquals(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.AREA_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("mock-area.html", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-area.html"));
    assertEquals(HREF_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.2-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(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.AREA_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("mock-image.jpeg", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-area.html"));
    assertEquals(HREF_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-03------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.2-2Failed-03");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.AREA_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-area.html"));
    assertEquals(HREF_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-04------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.2-2Failed-04");
    // 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(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.AREA_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-area.html"));
    assertEquals(HREF_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-05------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.2-2Failed-05");
    // 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> pIter = processResult.getRemarkSet().iterator();

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.AREA_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-area1.html"));
    assertEquals(HREF_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_ALT_PERTINENCE_OF_INFORMATIVE_IMG_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.AREA_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("Informative area alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-area2.html"));
    assertEquals(HREF_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.AREA_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("mock-area3.html", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-area3.html"));
    assertEquals(HREF_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_AND_ALT_PERTINENCE_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.AREA_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("not identified area alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-area4.html"));
    assertEquals(HREF_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-01------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.2-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(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.AREA_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("mock-area.html", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-area.html"));
    assertEquals(HREF_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.2-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(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.AREA_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("mock-image.jpeg", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-area.html"));
    assertEquals(HREF_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-03------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.2-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(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.AREA_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-area.html"));
    assertEquals(HREF_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-04------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.2-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(RemarkMessageStore.CHECK_ALT_PERTINENCE_OF_INFORMATIVE_IMG_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.AREA_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("Informative area alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-area.html"));
    assertEquals(HREF_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-05---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.2-3NMI-05");
    // 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(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_AND_ALT_PERTINENCE_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.AREA_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("Not identified area alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-area.html"));
    assertEquals(HREF_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-06---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.2-3NMI-06");
    // 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());
    pIter = processResult.getRemarkSet().iterator();

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_ALT_PERTINENCE_OF_INFORMATIVE_IMG_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.AREA_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("Informative area alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-area2.html"));
    assertEquals(HREF_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.AREA_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("mock-area3.html", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-area3.html"));
    assertEquals(HREF_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_AND_ALT_PERTINENCE_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.AREA_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("not identified area alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-area4.html"));
    assertEquals(HREF_ATTR, ee.getEvidence().getCode());

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

From source file:org.asqatasun.rules.accessiweb22.Aw22Rule01033Test.java

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------2Failed-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.1.3.3-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());/*from  ww  w  .ja  v  a2  s .  c o m*/
    assertEquals(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.INPUT_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("mock-image", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.3-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(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.INPUT_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("mock-image.png", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-03------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.3-2Failed-03");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.INPUT_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-04------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.3-2Failed-04");
    // 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(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.INPUT_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-05------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.3-2Failed-05");
    // 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> pIter = processResult.getRemarkSet().iterator();

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.INPUT_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image1"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_ALT_PERTINENCE_OF_INFORMATIVE_IMG_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.INPUT_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("Informative input alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image2"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.INPUT_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("mock-image3", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image3"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_AND_ALT_PERTINENCE_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.INPUT_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("not identified input alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image4"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-01------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.3-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(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.INPUT_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("mock-image", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.3-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(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.INPUT_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("mock-image.png", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-03------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.3-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(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.INPUT_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-04------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.3-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(RemarkMessageStore.CHECK_ALT_PERTINENCE_OF_INFORMATIVE_IMG_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.INPUT_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("Informative input alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-05---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.3-3NMI-05");
    // 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(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_AND_ALT_PERTINENCE_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.INPUT_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("Not identified input alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-06---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.3-3NMI-06");
    // 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());
    pIter = processResult.getRemarkSet().iterator();

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_ALT_PERTINENCE_OF_INFORMATIVE_IMG_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.INPUT_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("Informative input alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image2"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.INPUT_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("mock-image3", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image3"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_AND_ALT_PERTINENCE_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.INPUT_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("not identified input alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock-image4"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

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

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

From source file:org.asqatasun.rules.accessiweb22.Aw22Rule01034Test.java

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------2Failed-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.1.3.4-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());// w w  w  .j av  a 2 s  . c o  m
    assertEquals(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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("mock.class", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.4-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(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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("mock-image.png", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-03------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.4-2Failed-03");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-04------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.4-2Failed-04");
    // 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(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------2Failed-05------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.4-2Failed-05");
    // 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> pIter = processResult.getRemarkSet().iterator();

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.NOT_PERTINENT_ALT_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.FAILED, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock1.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_ALT_PERTINENCE_OF_INFORMATIVE_IMG_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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("Informative applet alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock2.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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("mock3.class", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock3.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_AND_ALT_PERTINENCE_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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("not identified applet alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock4.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-01------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.4-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(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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("mock.class", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.4-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(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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("image.png", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-03------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.4-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(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-04------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.4-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(RemarkMessageStore.CHECK_ALT_PERTINENCE_OF_INFORMATIVE_IMG_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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("Informative applet alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-05---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.4-3NMI-05");
    // 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(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_AND_ALT_PERTINENCE_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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("Not identified applet alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    //----------------------------------------------------------------------
    //------------------------------3NMI-06---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.1.3.4-3NMI-06");
    // 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());
    pIter = processResult.getRemarkSet().iterator();

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_ALT_PERTINENCE_OF_INFORMATIVE_IMG_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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("Informative applet alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock2.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_PERTINENT_ALT_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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("mock3.class", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock3.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

    processRemark = (SourceCodeRemark) pIter.next();
    assertEquals(RemarkMessageStore.CHECK_NATURE_OF_IMAGE_AND_ALT_PERTINENCE_MSG,
            processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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("not identified applet alternative", ee.getValue());
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock4.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

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

From source file:org.asqatasun.rules.accessiweb22.Aw22Rule01041Test.java

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------3NMI-01---------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.1.4.1-3NMI-01");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet())
            .iterator().next());//from ww  w .  j  av  a  2 s .  c  o m
    assertEquals(RemarkMessageStore.CHECK_CAPTCHA_ALTERNATIVE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.IMG_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(), "captcha");
    assertEquals(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_image.jpg"));
    assertEquals(SRC_ATTR, ee.getEvidence().getCode());

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

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

From source file:org.asqatasun.rules.accessiweb22.Aw22Rule01043Test.java

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------3NMI-01---------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.1.4.3-3NMI-01");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet())
            .iterator().next());//from   w  ww  .  jav  a 2s .c om
    assertEquals(RemarkMessageStore.CHECK_CAPTCHA_ALTERNATIVE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.APPLET_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(ALT_ATTR, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock.class"));
    assertEquals(CODE_ATTR, ee.getEvidence().getCode());

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

From source file:org.asqatasun.rules.accessiweb22.Aw22Rule01045Test.java

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------3NMI-01---------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.1.4.5-3NMI-01");
    // check number of elements in the page
    assertEquals(1, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet())
            .iterator().next());//from   w w w . j a  v a  2  s. co  m
    assertEquals(RemarkMessageStore.CHECK_CAPTCHA_ALTERNATIVE_MSG, processRemark.getMessageCode());
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(HtmlElementStore.OBJECT_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("Some text can be added here.", ee.getValue());
    assertEquals(HtmlElementStore.TEXT_ELEMENT2, ee.getEvidence().getCode());
    ee = iter.next();
    assertTrue(StringUtils.contains(ee.getValue(), "mock_image.gif"));
    assertEquals(DATA_ATTR, ee.getEvidence().getCode());

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

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