List of usage examples for org.apache.commons.lang3 StringUtils contains
public static boolean contains(final CharSequence seq, final CharSequence searchSeq)
Checks if CharSequence contains a search CharSequence, handling null .
From source file:org.apereo.openlrs.controllers.xapi.XAPIHeaderFilter.java
@Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { String allowedRequestHeaders = request.getHeader("Access-Control-Request-Headers"); String responseHeader = XApiConstants.XAPI_VERSION_HEADER; if (StringUtils.isNotBlank(allowedRequestHeaders)) { if (StringUtils.contains(allowedRequestHeaders, XApiConstants.XAPI_VERSION_HEADER.toLowerCase())) { responseHeader = responseHeader.toLowerCase(); }/*w w w.j av a 2s .c o m*/ } response.addHeader(responseHeader, version); filterChain.doFilter(request, response); }
From source file:org.apereo.openlrs.model.event.EventConversionService.java
private String parseContextXApi(Statement xapi) { String context = null;/*from w w w . j a v a 2s . c o m*/ XApiContext xApiContext = xapi.getContext(); if (xApiContext != null) { XApiContextActivities xApiContextActivities = xApiContext.getContextActivities(); if (xApiContextActivities != null) { List<XApiObject> parentContext = xApiContextActivities.getParent(); if (parentContext != null && !parentContext.isEmpty()) { for (XApiObject object : parentContext) { String id = object.getId(); if (StringUtils.contains(id, "portal/site/")) { context = StringUtils.substringAfterLast(id, "/"); break; } } } } } return context; }
From source file:org.apereo.openlrs.repositories.statements.ElasticSearchStatementRepository.java
private StatementMetadata extractMetadata(Statement statement) { StatementMetadata statementMetadata = new StatementMetadata(); statementMetadata.setId(UUID.randomUUID().toString()); statementMetadata.setStatementId(statement.getId()); XApiContext xApiContext = statement.getContext(); if (xApiContext != null) { XApiContextActivities xApiContextActivities = xApiContext.getContextActivities(); if (xApiContextActivities != null) { List<XApiObject> parentContext = xApiContextActivities.getParent(); if (parentContext != null && !parentContext.isEmpty()) { for (XApiObject object : parentContext) { String id = object.getId(); if (StringUtils.contains(id, "portal/site/")) { statementMetadata.setContext(StringUtils.substringAfterLast(id, "/")); }/*w w w . j a va2 s. c o m*/ } } } } XApiActor xApiActor = statement.getActor(); if (xApiActor != null) { String mbox = xApiActor.getMbox(); if (StringUtils.isNotBlank(mbox)) { statementMetadata.setUser(StringUtils.substringBetween(mbox, "mailto:", "@")); } } return statementMetadata; }
From source file:org.apereo.openlrs.XAPIHeaderFilter.java
@Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { String allowedRequestHeaders = request.getHeader("Access-Control-Request-Headers"); String responseHeader = Constants.XAPI_VERSION_HEADER; if (StringUtils.isNotBlank(allowedRequestHeaders)) { if (StringUtils.contains(allowedRequestHeaders, Constants.XAPI_VERSION_HEADER.toLowerCase())) { responseHeader = responseHeader.toLowerCase(); }/* w ww .java 2 s . c o m*/ } response.addHeader(responseHeader, version); filterChain.doFilter(request, response); }
From source file:org.asqatasun.rules.accessiweb22.Aw22Rule01011Test.java
@Override protected void setProcess() { //---------------------------------------------------------------------- //------------------------------1Passed-01------------------------------ //---------------------------------------------------------------------- ProcessResult processResult = processPageTest("AW22.Test.1.1.1-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()); //---------------------------------------------------------------------- //------------------------------2Failed-01------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.1.1-2Failed-01"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()) .iterator().next());//from w w w .j a v a 2 s . co m assertEquals(RemarkMessageStore.ALT_MISSING_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(1, processRemark.getElementList().size()); EvidenceElement ee = processRemark.getElementList().iterator().next(); assertEquals(SRC_ATTR, ee.getEvidence().getCode()); assertTrue(StringUtils.contains(ee.getValue(), "mock-image-failed.jpg")); //---------------------------------------------------------------------- //------------------------------2Failed-02------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.1.1-2Failed-02"); // check number of elements in the page assertEquals(2, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(RemarkMessageStore.ALT_MISSING_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(1, processRemark.getElementList().size()); ee = processRemark.getElementList().iterator().next(); assertTrue(StringUtils.contains(ee.getValue(), "mock-image-failed.jpg")); assertEquals(SRC_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------2Failed-03------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.1.1-2Failed-03"); // check number of elements in the page assertEquals(2, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(RemarkMessageStore.ALT_MISSING_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(1, processRemark.getElementList().size()); ee = processRemark.getElementList().iterator().next(); assertTrue(StringUtils.contains(ee.getValue(), "mock-image-failed.jpg")); assertEquals(SRC_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------4NA-01------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.1.1-4NA-01"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); }
From source file:org.asqatasun.rules.accessiweb22.Aw22Rule01012Test.java
@Override protected void setProcess() { //---------------------------------------------------------------------- //------------------------------1Passed-01------------------------------ //---------------------------------------------------------------------- ProcessResult processResult = processPageTest("AW22.Test.1.1.2-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(2, processResult.getElementCounter()); //---------------------------------------------------------------------- //------------------------------1Passed-02------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.1.2-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(2, processResult.getElementCounter()); //---------------------------------------------------------------------- //------------------------------1Passed-03------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.1.2-1Passed-03"); // check test result assertEquals(TestSolution.PASSED, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(2, processResult.getElementCounter()); //---------------------------------------------------------------------- //------------------------------2Failed-01------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.1.2-2Failed-01"); // check number of elements in the page assertEquals(2, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(2, processResult.getRemarkSet().size()); SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()) .iterator().next());/*from w w w. j a v a 2 s. co m*/ assertEquals(RemarkMessageStore.ALT_MISSING_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(1, processRemark.getElementList().size()); EvidenceElement ee = processRemark.getElementList().iterator().next(); assertEquals(ABSENT_ATTRIBUTE_VALUE, ee.getValue()); assertEquals(HREF_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------2Failed-02------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.1.2-2Failed-02"); // check number of elements in the page assertEquals(2, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(2, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(RemarkMessageStore.ALT_MISSING_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(1, processRemark.getElementList().size()); ee = processRemark.getElementList().iterator().next(); assertEquals(ABSENT_ATTRIBUTE_VALUE, ee.getValue()); assertEquals(HREF_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------2Failed-03------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.1.2-2Failed-03"); // check number of elements in the page assertEquals(2, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(RemarkMessageStore.ALT_MISSING_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(1, processRemark.getElementList().size()); ee = processRemark.getElementList().iterator().next(); assertTrue(StringUtils.contains(ee.getValue(), "mock-area-link.html")); assertEquals(HREF_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------4NA-01------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.1.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.1.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()); }
From source file:org.asqatasun.rules.accessiweb22.Aw22Rule01013Test.java
@Override protected void setProcess() { //---------------------------------------------------------------------- //------------------------------1Passed-01------------------------------ //---------------------------------------------------------------------- ProcessResult processResult = processPageTest("AW22.Test.1.1.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.1.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()); //---------------------------------------------------------------------- //------------------------------2Failed-01------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.1.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 . j ava2 s .c o m*/ assertEquals(RemarkMessageStore.ALT_MISSING_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(1, processRemark.getElementList().size()); EvidenceElement ee = processRemark.getElementList().iterator().next(); assertEquals(ABSENT_ATTRIBUTE_VALUE, ee.getValue()); assertEquals(SRC_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------2Failed-02------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.1.3-2Failed-02"); // check number of elements in the page assertEquals(2, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(RemarkMessageStore.ALT_MISSING_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(1, processRemark.getElementList().size()); ee = processRemark.getElementList().iterator().next(); assertTrue(StringUtils.contains(ee.getValue(), "mock-input-src.jpg")); assertEquals(SRC_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------4NA-01------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.1.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.1.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()); }
From source file:org.asqatasun.rules.accessiweb22.Aw22Rule01014Test.java
@Override protected void setProcess() { //---------------------------------------------------------------------- //------------------------------1Passed-01------------------------------ //---------------------------------------------------------------------- ProcessResult processResult = processPageTest("AW22.Test.1.1.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()); //---------------------------------------------------------------------- //------------------------------2Failed-01------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.1.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 w w .j av a2 s .c om*/ assertEquals(TestSolution.FAILED, processRemark.getIssue()); assertEquals(HtmlElementStore.APPLET_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.class")); assertEquals(CODE_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------4NA-01------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.1.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()); }
From source file:org.asqatasun.rules.accessiweb22.Aw22Rule01021Test.java
@Override protected void setProcess() { //---------------------------------------------------------------------- //------------------------------1Passed-01------------------------------ //---------------------------------------------------------------------- ProcessResult processResult = processPageTest("AW22.Test.1.2.1-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.1-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.1-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.1-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.1-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.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 a va2s .co m*/ assertEquals(RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_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(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "mock-decorative-image.jpg")); assertEquals(SRC_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------2Failed-02------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.1-2Failed-02"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.FAILED, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_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(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "mock-decorative-image.jpg")); assertEquals(SRC_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------2Failed-03------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.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.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_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(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "mock-decorative-image.jpg")); assertEquals(SRC_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------2Failed-04------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.1-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.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(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "mock-decorative-image1.jpg")); assertEquals(SRC_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.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(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "mock-decorative-image2.jpg")); assertEquals(SRC_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.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(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "mock-decorative-image3.jpg")); assertEquals(SRC_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------2Failed-05------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.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.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_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(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "mock-decorative-image.jpg")); assertEquals(SRC_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------3NMI-01--------------------------------- //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.1-3NMI-01"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(RemarkMessageStore.CHECK_ELEMENT_WITH_NOT_EMPTY_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(); assertTrue(StringUtils.contains(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-02--------------------------------- //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.1-3NMI-02"); // check number of elements in the page assertEquals(1, processResult.getElementCounter()); // check test result assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue()); // check number of remarks and their value assertEquals(1, processResult.getRemarkSet().size()); processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next()); assertEquals(RemarkMessageStore.CHECK_ELEMENT_WITH_EMPTY_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(); assertTrue(StringUtils.contains(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-03--------------------------------- //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.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_ELEMENT_WITH_NOT_EMPTY_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(); assertTrue(StringUtils.contains(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.2.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_ELEMENT_WITH_EMPTY_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(); assertTrue(StringUtils.contains(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.2.1-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.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(); assertTrue(StringUtils.contains(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.2.1-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.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(); assertTrue(StringUtils.contains(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()); //---------------------------------------------------------------------- //------------------------------4NA-01---------------------------------- //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.1-4NA-01"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(0, processResult.getElementCounter()); //---------------------------------------------------------------------- //------------------------------4NA-02---------------------------------- //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.1-4NA-02"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(0, processResult.getElementCounter()); //---------------------------------------------------------------------- //------------------------------4NA-03---------------------------------- //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.1-4NA-03"); // check test result assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue()); // check test has no remark assertNull(processResult.getRemarkSet()); // check number of elements in the page assertEquals(0, processResult.getElementCounter()); //---------------------------------------------------------------------- //------------------------------4NA-04---------------------------------- //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.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.2.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.Aw22Rule01022Test.java
@Override protected void setProcess() { //---------------------------------------------------------------------- //------------------------------1Passed-01------------------------------ //---------------------------------------------------------------------- ProcessResult processResult = processPageTest("AW22.Test.1.2.2-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.2-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.2-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.2-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.2-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.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());//from w ww .j av a2 s. c om assertEquals(RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_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(1, 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()); //---------------------------------------------------------------------- //------------------------------2Failed-02------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.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.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_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(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------2Failed-03------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.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.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_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(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------2Failed-04------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-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.AREA_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_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.AREA_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_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.AREA_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------2Failed-05------------------------------ //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-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.AREA_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "Not empty alt")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------3NMI-01--------------------------------- //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.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_ELEMENT_WITH_NOT_EMPTY_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(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------3NMI-02--------------------------------- //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.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_ELEMENT_WITH_EMPTY_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(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------3NMI-03--------------------------------- //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.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_ELEMENT_WITH_NOT_EMPTY_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(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------3NMI-04--------------------------------- //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.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_ELEMENT_WITH_EMPTY_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(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------3NMI-05--------------------------------- //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-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.AREA_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------3NMI-06--------------------------------- //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-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.AREA_ELEMENT, processRemark.getTarget()); assertNotNull(processRemark.getSnippet()); // check number of evidence elements and their value assertEquals(1, processRemark.getElementList().size()); iter = processRemark.getElementList().iterator(); ee = iter.next(); assertTrue(StringUtils.contains(ee.getValue(), "")); assertEquals(ALT_ATTR, ee.getEvidence().getCode()); //---------------------------------------------------------------------- //------------------------------4NA-01---------------------------------- //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.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.2.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.2.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.2.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()); //---------------------------------------------------------------------- //------------------------------4NA-05---------------------------------- //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-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.2.2-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()); //---------------------------------------------------------------------- //------------------------------4NA-07---------------------------------- //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-4NA-07"); // 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-08---------------------------------- //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-4NA-08"); // 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-09---------------------------------- //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-4NA-09"); // 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-10---------------------------------- //---------------------------------------------------------------------- processResult = processPageTest("AW22.Test.1.2.2-4NA-10"); // 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()); }