Search in sources :

Example 41 with ProcessRemark

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

the class Aw22Rule08013Test method setProcess.

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------1Passed-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.8.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 (no counter management here, 
    // we test the presence of one tag in the page)
    assertEquals(0, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------2Failed-01------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.8.1.3-2Failed-01");
    // check number of elements in the page (no counter management here, 
    // we test the presence of one tag in the page)
    assertEquals(0, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    ProcessRemark processRemark = ((ProcessRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(RemarkMessageStore.BAD_DOCTYPE_LOCATION_MSG, processRemark.getMessageCode());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    //----------------------------------------------------------------------
    //------------------------------2Failed-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.8.1.3-2Failed-02");
    // check number of elements in the page (no counter management here, 
    // we test the presence of one tag in the page)
    assertEquals(0, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    processRemark = ((ProcessRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(RemarkMessageStore.BAD_DOCTYPE_LOCATION_MSG, processRemark.getMessageCode());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    //----------------------------------------------------------------------
    //------------------------------4NA-01------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.8.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 (no counter management here, 
    // we test the presence of one tag in the page)
    assertEquals(0, processResult.getElementCounter());
}
Also used : LinkedHashSet(java.util.LinkedHashSet) ProcessResult(org.asqatasun.entity.audit.ProcessResult) ProcessRemark(org.asqatasun.entity.audit.ProcessRemark)

Example 42 with ProcessRemark

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

the class Aw22Rule09011Test method setProcess.

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------1Passed-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.9.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());
    //----------------------------------------------------------------------
    //------------------------------1Passed-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.9.1.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(2, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------2Failed-01------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.9.1.1-2Failed-01");
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    assertTrue(processResult.getRemarkSet().iterator().next() instanceof ProcessRemark);
    assertEquals(RemarkMessageStore.H1_TAG_MISSING_MSG, processResult.getRemarkSet().iterator().next().getMessageCode());
    //----------------------------------------------------------------------
    //------------------------------2Failed-02------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.9.1.1-2Failed-02");
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    assertTrue(processResult.getRemarkSet().iterator().next() instanceof ProcessRemark);
    assertEquals(RemarkMessageStore.H1_TAG_MISSING_MSG, processResult.getRemarkSet().iterator().next().getMessageCode());
}
Also used : ProcessResult(org.asqatasun.entity.audit.ProcessResult) ProcessRemark(org.asqatasun.entity.audit.ProcessRemark)

Example 43 with ProcessRemark

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

the class Aw22Rule07051Test method setProcess.

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------3NMI-01---------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.07.05.01-3NMI-01");
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    assertTrue(processResult.getRemarkSet().iterator().next() instanceof ProcessRemark);
    assertEquals(getMessageKey(RemarkMessageStore.NO_PATTERN_DETECTED_MSG), processResult.getRemarkSet().iterator().next().getMessageCode());
    //----------------------------------------------------------------------
    //------------------------------3NMI-02---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.07.05.01-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());
    Iterator<ProcessRemark> iter = processResult.getRemarkSet().iterator();
    SourceCodeRemark processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CONTEXT_CHANGED_SCRIPT_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.SELECT_ELEMENT, processRemark.getTarget());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    //----------------------------------------------------------------------
    //------------------------------3NMI-03---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.07.05.01-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());
    iter = processResult.getRemarkSet().iterator();
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CONTEXT_CHANGED_SCRIPT_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.FORM_ELEMENT, processRemark.getTarget());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    //----------------------------------------------------------------------
    //------------------------------3NMI-04---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.07.05.01-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());
    iter = processResult.getRemarkSet().iterator();
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CONTEXT_CHANGED_SCRIPT_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.SELECT_ELEMENT, processRemark.getTarget());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    //----------------------------------------------------------------------
    //------------------------------3NMI-05---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.07.05.01-3NMI-05");
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    assertTrue(processResult.getRemarkSet().iterator().next() instanceof ProcessRemark);
    assertEquals(getMessageKey(RemarkMessageStore.NO_PATTERN_DETECTED_MSG), processResult.getRemarkSet().iterator().next().getMessageCode());
    //----------------------------------------------------------------------
    //------------------------------3NMI-06---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.07.05.01-3NMI-06");
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    assertTrue(processResult.getRemarkSet().iterator().next() instanceof ProcessRemark);
    assertEquals(getMessageKey(RemarkMessageStore.NO_PATTERN_DETECTED_MSG), processResult.getRemarkSet().iterator().next().getMessageCode());
    //----------------------------------------------------------------------
    //------------------------------3NMI-07---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.07.05.01-3NMI-07");
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    assertTrue(processResult.getRemarkSet().iterator().next() instanceof ProcessRemark);
    assertEquals(getMessageKey(RemarkMessageStore.NO_PATTERN_DETECTED_MSG), processResult.getRemarkSet().iterator().next().getMessageCode());
    //----------------------------------------------------------------------
    //------------------------------3NMI-08---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.07.05.01-3NMI-08");
    // check number of elements in the page
    assertEquals(0, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    assertTrue(processResult.getRemarkSet().iterator().next() instanceof ProcessRemark);
    assertEquals(getMessageKey(RemarkMessageStore.NO_PATTERN_DETECTED_MSG), processResult.getRemarkSet().iterator().next().getMessageCode());
    //----------------------------------------------------------------------
    //------------------------------3NMI-09---------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.07.05.01-3NMI-09");
    // check number of elements in the page
    assertEquals(2, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(2, processResult.getRemarkSet().size());
    iter = processResult.getRemarkSet().iterator();
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CONTEXT_CHANGED_SCRIPT_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.FORM_ELEMENT, processRemark.getTarget());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.CONTEXT_CHANGED_SCRIPT_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.SELECT_ELEMENT, processRemark.getTarget());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
}
Also used : ProcessResult(org.asqatasun.entity.audit.ProcessResult) SourceCodeRemark(org.asqatasun.entity.audit.SourceCodeRemark) ProcessRemark(org.asqatasun.entity.audit.ProcessRemark)

Example 44 with ProcessRemark

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

the class Aw22Rule08011Test method setProcess.

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------1Passed-01------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.8.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 (no counter management here, 
    // we test the presence of one tag in the page)
    assertEquals(0, processResult.getElementCounter());
    //----------------------------------------------------------------------
    //------------------------------2Failed-01------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.8.1.1-2Failed-01");
    // check number of elements in the page (no counter management here, 
    // we test the presence of one tag in the page)
    assertEquals(0, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.FAILED, processResult.getValue());
    // check number of remarks and their value
    assertEquals(1, processResult.getRemarkSet().size());
    ProcessRemark processRemark = ((ProcessRemark) ((LinkedHashSet) processResult.getRemarkSet()).iterator().next());
    assertEquals(RemarkMessageStore.DOCTYPE_MISSING_MSG, processRemark.getMessageCode());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
}
Also used : ProcessResult(org.asqatasun.entity.audit.ProcessResult) ProcessRemark(org.asqatasun.entity.audit.ProcessRemark)

Example 45 with ProcessRemark

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

the class Aw22Rule11083Test method setProcess.

@Override
protected void setProcess() {
    //----------------------------------------------------------------------
    //------------------------------3NMI-01---------------------------------
    //----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("AW22.Test.11.8.3-3NMI-01");
    // check number of elements in the page
    assertEquals(2, processResult.getElementCounter());
    // check test result
    assertEquals(TestSolution.NEED_MORE_INFO, processResult.getValue());
    // check number of remarks and their value
    assertEquals(2, processResult.getRemarkSet().size());
    Iterator<ProcessRemark> iter = processResult.getRemarkSet().iterator();
    SourceCodeRemark processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.OPTGROUP_ELEMENT, processRemark.getTarget());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    processRemark = (SourceCodeRemark) iter.next();
    assertEquals(TestSolution.NEED_MORE_INFO, processRemark.getIssue());
    assertEquals(RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, processRemark.getMessageCode());
    assertEquals(HtmlElementStore.OPTGROUP_ELEMENT, processRemark.getTarget());
    // check number of evidence elements and their value
    assertNull(processRemark.getElementList());
    //----------------------------------------------------------------------
    //------------------------------4NA-01----------------------------------
    //----------------------------------------------------------------------
    processResult = processPageTest("AW22.Test.11.8.3-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.8.3-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.8.3-4NA-03");
    // check test result
    assertEquals(TestSolution.NOT_APPLICABLE, processResult.getValue());
    // check test has no remark
    assertNull(processResult.getRemarkSet());
}
Also used : ProcessResult(org.asqatasun.entity.audit.ProcessResult) SourceCodeRemark(org.asqatasun.entity.audit.SourceCodeRemark) ProcessRemark(org.asqatasun.entity.audit.ProcessRemark)

Aggregations

ProcessRemark (org.asqatasun.entity.audit.ProcessRemark)56 ProcessResult (org.asqatasun.entity.audit.ProcessResult)41 SourceCodeRemark (org.asqatasun.entity.audit.SourceCodeRemark)31 LinkedHashSet (java.util.LinkedHashSet)23 ElementHandlerImpl (org.asqatasun.ruleimplementation.ElementHandlerImpl)6 TestSolutionHandler (org.asqatasun.ruleimplementation.TestSolutionHandler)6 TestSolutionHandlerImpl (org.asqatasun.ruleimplementation.TestSolutionHandlerImpl)6 Element (org.jsoup.nodes.Element)6 ProcessRemarkService (org.asqatasun.service.ProcessRemarkService)5 EvidenceElement (org.asqatasun.entity.audit.EvidenceElement)4