use of org.asqatasun.entity.audit.EvidenceElement in project Asqatasun by Asqatasun.
the class Aw22Rule11022Test method setProcess.
@Override
protected void setProcess() {
//----------------------------------------------------------------------
//------------------------------3NMI-01---------------------------------
//----------------------------------------------------------------------
ProcessResult processResult = processPageTest("AW22.Test.11.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());
SourceCodeRemark processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.INPUT_ELEMENT, processRemark.getTarget());
// check number of evidence elements and their value
assertEquals(1, processRemark.getElementList().size());
EvidenceElement ee = processRemark.getElementList().iterator().next();
assertEquals("input title", ee.getValue());
assertEquals(TITLE_ATTR, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------3NMI-02---------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.11.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(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.INPUT_ELEMENT, processRemark.getTarget());
// check number of evidence elements and their value
assertEquals(1, processRemark.getElementList().size());
ee = processRemark.getElementList().iterator().next();
assertEquals("input title", ee.getValue());
assertEquals(TITLE_ATTR, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------3NMI-03---------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.11.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(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.INPUT_ELEMENT, processRemark.getTarget());
// check number of evidence elements and their value
assertEquals(1, processRemark.getElementList().size());
ee = processRemark.getElementList().iterator().next();
assertEquals("input title", ee.getValue());
assertEquals(TITLE_ATTR, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------3NMI-04---------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.11.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(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.INPUT_ELEMENT, processRemark.getTarget());
// check number of evidence elements and their value
assertEquals(1, processRemark.getElementList().size());
ee = processRemark.getElementList().iterator().next();
assertEquals("input title", ee.getValue());
assertEquals(TITLE_ATTR, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------3NMI-05---------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.11.2.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(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.INPUT_ELEMENT, processRemark.getTarget());
// check number of evidence elements and their value
assertEquals(1, processRemark.getElementList().size());
ee = processRemark.getElementList().iterator().next();
assertEquals("input title", ee.getValue());
assertEquals(TITLE_ATTR, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------3NMI-06---------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.11.2.2-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(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.TEXTAREA_ELEMENT, processRemark.getTarget());
// check number of evidence elements and their value
assertEquals(1, processRemark.getElementList().size());
ee = processRemark.getElementList().iterator().next();
assertEquals("input title", ee.getValue());
assertEquals(TITLE_ATTR, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------3NMI-07---------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.11.2.2-3NMI-07");
// check number of elements in the page
assertEquals(1, processResult.getElementCounter());
// check test result
assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
// check number of remarks and their value
assertEquals(1, processResult.getRemarkSet().size());
processRemark = ((SourceCodeRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.SELECT_ELEMENT, processRemark.getTarget());
// check number of evidence elements and their value
assertEquals(1, processRemark.getElementList().size());
ee = processRemark.getElementList().iterator().next();
assertEquals("input title", ee.getValue());
assertEquals(TITLE_ATTR, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------4NA-01----------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.11.2.2-4NA-01");
// check test result
assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
// check test has no remark
assertNull(processResult.getRemarkSet());
//----------------------------------------------------------------------
//------------------------------4NA-02----------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.11.2.2-4NA-02");
// check test result
assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
// check test has no remark
assertNull(processResult.getRemarkSet());
//----------------------------------------------------------------------
//------------------------------4NA-03----------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.11.2.2-4NA-03");
// check test result
assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
// check test has no remark
assertNull(processResult.getRemarkSet());
//----------------------------------------------------------------------
//------------------------------4NA-04----------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.11.2.2-4NA-04");
// check test result
assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
// check test has no remark
assertNull(processResult.getRemarkSet());
//----------------------------------------------------------------------
//------------------------------4NA-05----------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.11.2.2-4NA-05");
// check test result
assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
// check test has no remark
assertNull(processResult.getRemarkSet());
//----------------------------------------------------------------------
//------------------------------4NA-06----------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.11.2.2-4NA-06");
// check test result
assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
// check test has no remark
assertNull(processResult.getRemarkSet());
//----------------------------------------------------------------------
//------------------------------4NA-07----------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.11.2.2-4NA-07");
// check test result
assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
// check test has no remark
assertNull(processResult.getRemarkSet());
}
use of org.asqatasun.entity.audit.EvidenceElement in project Asqatasun by Asqatasun.
the class Aw22Rule08082Test method setProcess.
@Override
protected void setProcess() {
//----------------------------------------------------------------------
//---------------------------1Passed-01---------------------------------
//----------------------------------------------------------------------
ProcessResult processResult = processPageTest("AW22.Test.8.8.2-1Passed-01");
// check number of elements in the page
assertEquals(1, processResult.getElementCounter());
// check test result
assertEquals(TestSolution.PASSED, processResult.getValue());
// check number of remarks and their value
assertNull(processResult.getRemarkSet());
//----------------------------------------------------------------------
//---------------------------2Failed-01---------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.8.8.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());
assertEquals(TestSolution.FAILED, processRemark.getIssue());
assertEquals(RemarkMessageStore.IRRELEVANT_LANG_DECL_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.DIV_ELEMENT, processRemark.getTarget());
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertEquals(3, processRemark.getElementList().size());
Iterator<EvidenceElement> pIter = processRemark.getElementList().iterator();
EvidenceElement ee = pIter.next();
assertEquals("fr", ee.getValue());
assertEquals(EvidenceStore.LANGUAGE_EE, ee.getEvidence().getCode());
ee = pIter.next();
assertEquals("en", ee.getValue());
assertEquals(EvidenceStore.DETECTED_LANGUAGE_EE, ee.getEvidence().getCode());
ee = pIter.next();
assertTrue(ee.getValue().contains("Some text is written here in english"));
assertEquals(EvidenceStore.EXTRACTED_TEXT_EE, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------3NMI-01------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.8.8.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(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.SUSPECTED_RELEVANT_LANG_DECL_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.DIV_ELEMENT, processRemark.getTarget());
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertEquals(3, processRemark.getElementList().size());
pIter = processRemark.getElementList().iterator();
ee = pIter.next();
assertEquals("fr", ee.getValue());
assertEquals(EvidenceStore.LANGUAGE_EE, ee.getEvidence().getCode());
ee = pIter.next();
assertEquals("fr", ee.getValue());
assertEquals(EvidenceStore.DETECTED_LANGUAGE_EE, ee.getEvidence().getCode());
ee = pIter.next();
assertTrue(ee.getValue().contains("Texte en francais"));
assertEquals(EvidenceStore.EXTRACTED_TEXT_EE, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------3NMI-02------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.8.8.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(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.SUSPECTED_RELEVANT_LANG_DECL_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.DIV_ELEMENT, processRemark.getTarget());
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertEquals(3, processRemark.getElementList().size());
pIter = processRemark.getElementList().iterator();
ee = pIter.next();
assertEquals("fr", ee.getValue());
assertEquals(EvidenceStore.LANGUAGE_EE, ee.getEvidence().getCode());
ee = pIter.next();
assertEquals("fr", ee.getValue());
assertEquals(EvidenceStore.DETECTED_LANGUAGE_EE, ee.getEvidence().getCode());
ee = pIter.next();
assertTrue(ee.getValue().contains("Texte en francais"));
assertEquals(EvidenceStore.EXTRACTED_TEXT_EE, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------3NMI-03---------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.8.8.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(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.SUSPECTED_IRRELEVANT_LANG_DECL_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.DIV_ELEMENT, processRemark.getTarget());
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertEquals(3, processRemark.getElementList().size());
pIter = processRemark.getElementList().iterator();
ee = pIter.next();
assertEquals("en", ee.getValue());
assertEquals(EvidenceStore.LANGUAGE_EE, ee.getEvidence().getCode());
ee = pIter.next();
assertEquals("fr", ee.getValue());
assertEquals(EvidenceStore.DETECTED_LANGUAGE_EE, ee.getEvidence().getCode());
ee = pIter.next();
assertTrue(ee.getValue().contains("Texte en francais"));
assertEquals(EvidenceStore.EXTRACTED_TEXT_EE, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------4NA-01----------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.8.8.2-4NA-01");
// check test result
assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
// check test has no remark
assertNull(processResult.getRemarkSet());
//----------------------------------------------------------------------
//------------------------------4NA-02----------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.8.8.2-4NA-02");
// check test result
assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
// check test has no remark
assertNull(processResult.getRemarkSet());
//----------------------------------------------------------------------
//------------------------------4NA-03----------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.8.8.2-4NA-03");
// check test result
assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
// check test has no remark
assertNull(processResult.getRemarkSet());
}
use of org.asqatasun.entity.audit.EvidenceElement in project Asqatasun by Asqatasun.
the class Aw22Rule06053Test method setProcess.
@Override
protected void setProcess() {
//----------------------------------------------------------------------
//------------------------------3NMI-01---------------------------------
//----------------------------------------------------------------------
ProcessResult processResult = processPageTest("AW22.Test.6.5.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());
assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.IMG_ELEMENT, processRemark.getTarget());
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertEquals(1, processRemark.getElementList().size());
EvidenceElement ee = processRemark.getElementList().iterator().next();
assertTrue(StringUtils.contains(ee.getValue(), "mock-image.jpg"));
assertEquals(SRC_ATTR, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------3NMI-02---------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.6.5.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(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
assertEquals(RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
assertEquals(HtmlElementStore.INPUT_ELEMENT, processRemark.getTarget());
assertNotNull(processRemark.getSnippet());
// check number of evidence elements and their value
assertEquals(1, processRemark.getElementList().size());
ee = processRemark.getElementList().iterator().next();
assertTrue(StringUtils.contains(ee.getValue(), "mock-image.jpg"));
assertEquals(SRC_ATTR, ee.getEvidence().getCode());
//----------------------------------------------------------------------
//------------------------------4NA-01---------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.6.5.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-01----------------------------------
//----------------------------------------------------------------------
processResult = processPageTest("AW22.Test.6.5.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());
}
use of org.asqatasun.entity.audit.EvidenceElement in project Asqatasun by Asqatasun.
the class ContrastChecker method createRemarkOnBadContrastElement.
/**
*
* @param sspHandler
* @param domElement
* @param contrast
* @return the TestSolution
*/
private TestSolution createRemarkOnBadContrastElement(SSPHandler sspHandler, DomElement domElement, String contrast) throws ContrastCheckerParseResultException {
TestSolution testSolution;
String msgCode;
if (domElement.isHidden()) {
// if the result is hidden, the result is NEED_MORE_INFO
testSolution = TestSolution.NEED_MORE_INFO;
msgCode = BAD_CONTRAST_HIDDEN_ELEMENT_MSG;
} else if (alternativeContrastMechanismPresent) {
// An alternative contrast mechanism is provided
testSolution = TestSolution.NEED_MORE_INFO;
msgCode = BAD_CONTRAST_BUT_ALT_MECHANISM_MSG;
} else {
// By default the result is failed
testSolution = TestSolution.FAILED;
msgCode = BAD_CONTRAST_MSG;
}
Element element = DomElementExtractor.getElementFromDomElement(domElement, sspHandler);
if (element != null) {
Collection<EvidenceElement> eeList = new LinkedList<>();
eeList.add(getEvidenceElement(FG_COLOR_EE, domElement.getFgColor()));
eeList.add(getEvidenceElement(BG_COLOR_EE, domElement.getBgColor()));
eeList.add(getEvidenceElement(CONTRAST_EE, contrast));
addSourceCodeRemark(testSolution, element, msgCode, eeList);
} else {
// the test returns not_tested to avoid false positive results
throw new ContrastCheckerParseResultException();
}
return testSolution;
}
use of org.asqatasun.entity.audit.EvidenceElement in project Asqatasun by Asqatasun.
the class ContrastChecker method createNmiRemarkForManualCheckElement.
/**
*
* @param sspHandler
* @param element
* @return
*/
private void createNmiRemarkForManualCheckElement(SSPHandler sspHandler, DomElement element) {
if (createSourceCodeRemarkForNmi) {
Element el = DomElementExtractor.getElementFromDomElement(element, sspHandler);
if (el != null) {
Collection<EvidenceElement> eeList = new ArrayList<>();
eeList.add(getEvidenceElement(FG_COLOR_EE, element.getFgColor()));
eeList.add(getEvidenceElement(BG_COLOR_EE, element.getBgColor()));
addSourceCodeRemark(TestSolution.NEED_MORE_INFO, el, CHECK_CONTRAST_MANUALLY_MSG, eeList);
}
} else if (!notTreatedBackgroundColorValue.contains(element.getBgColor())) {
List<EvidenceElement> eeList = new ArrayList<>();
eeList.add(getEvidenceElement(DEFAULT_EVIDENCE, element.getDisplayableBgColor()));
addSourceCodeRemark(TestSolution.NEED_MORE_INFO, null, NOT_TREATED_BACKGROUND_COLOR_MSG, eeList);
notTreatedBackgroundColorValue.add(element.getBgColor());
}
}
Aggregations