Search in sources :

Example 76 with Range

use of org.apache.commons.lang3.Range in project Asqatasun by Asqatasun.

the class Rgaa40Rule110201Test method setProcess.

@Override
protected void setProcess() {
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-01------------------------------
    // ----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("Rgaa40.Test.11.2.1-3NMI-01");
    checkResultIsPreQualified(processResult, 3, 3);
    checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.LABEL_ELEMENT, 1, new ImmutablePair(HtmlElementStore.TEXT_ELEMENT2, "Form 1, label 1 for input without type attribute"));
    checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.LABEL_ELEMENT, 2, new ImmutablePair(HtmlElementStore.TEXT_ELEMENT2, "Form 2, label 2 for input without type attribute"));
    checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.LABEL_ELEMENT, 3, new ImmutablePair(HtmlElementStore.TEXT_ELEMENT2, "Form 2, label 3 for textarea"));
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-02------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa40.Test.11.2.1-3NMI-02");
    checkResultIsPreQualified(processResult, 17, 17);
    HashMap<Integer, String> mapTypeAttribute = new HashMap<Integer, String>();
    mapTypeAttribute.put(1, "checkbox");
    mapTypeAttribute.put(2, "color");
    mapTypeAttribute.put(3, "date");
    mapTypeAttribute.put(4, "datetime-local");
    mapTypeAttribute.put(5, "email");
    mapTypeAttribute.put(6, "file");
    mapTypeAttribute.put(7, "month");
    mapTypeAttribute.put(8, "number");
    mapTypeAttribute.put(9, "password");
    mapTypeAttribute.put(10, "radio");
    mapTypeAttribute.put(11, "range");
    mapTypeAttribute.put(12, "search");
    mapTypeAttribute.put(13, "tel");
    mapTypeAttribute.put(14, "text");
    mapTypeAttribute.put(15, "time");
    mapTypeAttribute.put(16, "url");
    mapTypeAttribute.put(17, "week");
    for (Map.Entry item : mapTypeAttribute.entrySet()) {
        int position = ((int) item.getKey());
        checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.LABEL_ELEMENT, position, new ImmutablePair(HtmlElementStore.TEXT_ELEMENT2, "Label for input with type equal to " + item.getValue()));
    }
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-03------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa40.Test.11.2.1-3NMI-03");
    checkResultIsPreQualified(processResult, 2, 2);
    checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.LABEL_ELEMENT, 1, new ImmutablePair(HtmlElementStore.TEXT_ELEMENT2, "Form 1, label for select"));
    checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.LABEL_ELEMENT, 2, new ImmutablePair(HtmlElementStore.TEXT_ELEMENT2, "Form 2, label for datalist"));
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-04------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa40.Test.11.2.1-3NMI-04");
    checkResultIsPreQualified(processResult, 11, 11);
    HashMap<Integer, String> mapRoleAttribute = new HashMap<Integer, String>();
    mapRoleAttribute.put(1, "checkbox");
    mapRoleAttribute.put(2, "combobox");
    mapRoleAttribute.put(3, "listbox");
    mapRoleAttribute.put(4, "progressbar");
    mapRoleAttribute.put(5, "option");
    mapRoleAttribute.put(6, "radio");
    mapRoleAttribute.put(7, "searchbox");
    mapRoleAttribute.put(8, "slider");
    mapRoleAttribute.put(9, "spinbutton");
    mapRoleAttribute.put(10, "switch");
    mapRoleAttribute.put(11, "textbox");
    for (Map.Entry item : mapRoleAttribute.entrySet()) {
        int position = ((int) item.getKey());
        checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.LABEL_ELEMENT, position, new ImmutablePair(HtmlElementStore.TEXT_ELEMENT2, "Label value for ROLE " + item.getValue()));
    }
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-05------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa40.Test.11.2.1-3NMI-05");
    checkResultIsPreQualified(processResult, 3, 3);
    checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.LABEL_ELEMENT, 1, new ImmutablePair(HtmlElementStore.TEXT_ELEMENT2, "Label value for METER"));
    checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.LABEL_ELEMENT, 2, new ImmutablePair(HtmlElementStore.TEXT_ELEMENT2, "Label value for PROGRESS"));
    checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.LABEL_ELEMENT, 3, new ImmutablePair(HtmlElementStore.TEXT_ELEMENT2, "Label value for OUTPUT"));
    // ----------------------------------------------------------------------
    // ------------------------------4NA-01------------------------------
    // ----------------------------------------------------------------------
    checkResultIsNotApplicable(processPageTest("Rgaa40.Test.11.2.1-4NA-01"));
    // ----------------------------------------------------------------------
    // ------------------------------4NA-02------------------------------
    // ----------------------------------------------------------------------
    checkResultIsNotApplicable(processPageTest("Rgaa40.Test.11.2.1-4NA-02"));
    // ----------------------------------------------------------------------
    // ------------------------------4NA-03------------------------------
    // ----------------------------------------------------------------------
    checkResultIsNotApplicable(processPageTest("Rgaa40.Test.11.2.1-4NA-03"));
    // ----------------------------------------------------------------------
    // ------------------------------4NA-04------------------------------
    // ----------------------------------------------------------------------
    checkResultIsNotApplicable(processPageTest("Rgaa40.Test.11.2.1-4NA-04"));
}
Also used : ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) HashMap(java.util.HashMap) ProcessResult(org.asqatasun.entity.audit.ProcessResult) Map(java.util.Map) HashMap(java.util.HashMap)

Example 77 with Range

use of org.apache.commons.lang3.Range in project Asqatasun by Asqatasun.

the class Rgaa40Rule110203Test method setProcess.

@Override
protected void setProcess() {
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-01---------------------------------
    // ----------------------------------------------------------------------
    ProcessResult processResult = processPageTest("Rgaa40.Test.11.2.3-3NMI-01");
    checkResultIsPreQualified(processResult, 2, 2);
    checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.INPUT_ELEMENT, 1, new ImmutablePair(ARIA_LABEL_ATTR, "aria-label for input without type attribute (implicit text)"));
    checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.INPUT_ELEMENT, 2, new ImmutablePair(ARIA_LABEL_ATTR, "aria-label for input with type equal to text"));
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-02---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa40.Test.11.2.3-3NMI-02");
    checkResultIsPreQualified(processResult, 17, 17);
    HashMap<Integer, String> mapTypeAttribute = new HashMap<Integer, String>();
    mapTypeAttribute.put(1, "checkbox");
    mapTypeAttribute.put(2, "color");
    mapTypeAttribute.put(3, "date");
    mapTypeAttribute.put(4, "datetime-local");
    mapTypeAttribute.put(5, "email");
    mapTypeAttribute.put(6, "file");
    mapTypeAttribute.put(7, "month");
    mapTypeAttribute.put(8, "number");
    mapTypeAttribute.put(9, "password");
    mapTypeAttribute.put(10, "radio");
    mapTypeAttribute.put(11, "range");
    mapTypeAttribute.put(12, "search");
    mapTypeAttribute.put(13, "tel");
    mapTypeAttribute.put(14, "text");
    mapTypeAttribute.put(15, "time");
    mapTypeAttribute.put(16, "url");
    mapTypeAttribute.put(17, "week");
    for (Map.Entry item : mapTypeAttribute.entrySet()) {
        int position = ((int) item.getKey());
        checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.INPUT_ELEMENT, position, new ImmutablePair(ARIA_LABEL_ATTR, "aria-label for input with type equal to " + item.getValue()));
    }
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-03---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa40.Test.11.2.3-3NMI-03");
    checkResultIsPreQualified(processResult, 1, 1);
    checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.TEXTAREA_ELEMENT, 1, new ImmutablePair(ARIA_LABEL_ATTR, "aria-label value for TEXTAREA"));
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-04---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa40.Test.11.2.3-3NMI-04");
    checkResultIsPreQualified(processResult, 3, 3);
    checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.SELECT_ELEMENT, 1, new ImmutablePair(ARIA_LABEL_ATTR, "aria-label value for SELECT"));
    checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.OPTGROUP_ELEMENT, 2, new ImmutablePair(ARIA_LABEL_ATTR, "aria-label value for OPTGROUP"));
    checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.OPTION_ELEMENT, 3, new ImmutablePair(ARIA_LABEL_ATTR, "aria-label value for OPTION"));
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-05---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa40.Test.11.2.3-3NMI-05");
    checkResultIsPreQualified(processResult, 1, 1);
    checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.DATALIST_ELEMENT, 1, new ImmutablePair(ARIA_LABEL_ATTR, "aria-label value for DATALIST"));
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-06---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa40.Test.11.2.3-3NMI-06");
    checkResultIsPreQualified(processResult, 3, 3);
    checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.PROGRESS_ELEMENT, 1, new ImmutablePair(ARIA_LABEL_ATTR, "aria-label value for PROGRESS"));
    checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.OUTPUT_ELEMENT, 2, new ImmutablePair(ARIA_LABEL_ATTR, "aria-label value for OUTPUT"));
    checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.METER_ELEMENT, 3, new ImmutablePair(ARIA_LABEL_ATTR, "aria-label value for METER"));
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-07---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa40.Test.11.2.3-3NMI-07");
    checkResultIsPreQualified(processResult, 11, 11);
    HashMap<Integer, String> mapRoleAttribute = new HashMap<Integer, String>();
    mapRoleAttribute.put(1, "checkbox");
    mapRoleAttribute.put(2, "combobox");
    mapRoleAttribute.put(3, "listbox");
    mapRoleAttribute.put(4, "progressbar");
    mapRoleAttribute.put(5, "option");
    mapRoleAttribute.put(6, "radio");
    mapRoleAttribute.put(7, "searchbox");
    mapRoleAttribute.put(8, "slider");
    mapRoleAttribute.put(9, "spinbutton");
    mapRoleAttribute.put(10, "switch");
    mapRoleAttribute.put(11, "textbox");
    for (Map.Entry item : mapRoleAttribute.entrySet()) {
        int position = ((int) item.getKey());
        checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.DIV_ELEMENT, position, new ImmutablePair(ARIA_LABEL_ATTR, "aria-label value for ROLE " + item.getValue()));
    }
    // ----------------------------------------------------------------------
    // ------------------------------3NMI-08---------------------------------
    // ----------------------------------------------------------------------
    processResult = processPageTest("Rgaa40.Test.11.2.3-3NMI-08");
    checkResultIsPreQualified(processResult, 1, 1);
    checkRemarkIsPresent(processResult, TestSolution.NEED_MORE_INFO, RemarkMessageStore.MANUAL_CHECK_ON_ELEMENTS_MSG, HtmlElementStore.INPUT_ELEMENT, 1, new ImmutablePair(ARIA_LABEL_ATTR, "aria-label for input without parent form tag"));
    // ----------------------------------------------------------------------
    // ------------------------------4NA-01----------------------------------
    // ----------------------------------------------------------------------
    checkResultIsNotApplicable(processPageTest("Rgaa40.Test.11.2.3-4NA-01"));
    // ----------------------------------------------------------------------
    // ------------------------------4NA-02----------------------------------
    // ----------------------------------------------------------------------
    checkResultIsNotApplicable(processPageTest("Rgaa40.Test.11.2.3-4NA-02"));
    // ----------------------------------------------------------------------
    // ------------------------------4NA-03----------------------------------
    // ----------------------------------------------------------------------
    checkResultIsNotApplicable(processPageTest("Rgaa40.Test.11.2.3-4NA-03"));
    // ----------------------------------------------------------------------
    // ------------------------------4NA-04----------------------------------
    // ----------------------------------------------------------------------
    checkResultIsNotApplicable(processPageTest("Rgaa40.Test.11.2.3-4NA-04"));
    // ----------------------------------------------------------------------
    // ------------------------------4NA-05----------------------------------
    // ----------------------------------------------------------------------
    checkResultIsNotApplicable(processPageTest("Rgaa40.Test.11.2.3-4NA-05"));
    // ----------------------------------------------------------------------
    // ------------------------------4NA-06----------------------------------
    // ----------------------------------------------------------------------
    checkResultIsNotApplicable(processPageTest("Rgaa40.Test.11.2.3-4NA-06"));
    // ----------------------------------------------------------------------
    // ------------------------------4NA-07----------------------------------
    // ----------------------------------------------------------------------
    checkResultIsNotApplicable(processPageTest("Rgaa40.Test.11.2.3-4NA-07"));
    // ----------------------------------------------------------------------
    // ------------------------------4NA-08----------------------------------
    // ----------------------------------------------------------------------
    checkResultIsNotApplicable(processPageTest("Rgaa40.Test.11.2.3-4NA-08"));
}
Also used : ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) HashMap(java.util.HashMap) ProcessResult(org.asqatasun.entity.audit.ProcessResult) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

List (java.util.List)26 Map (java.util.Map)21 HashMap (java.util.HashMap)20 ArrayList (java.util.ArrayList)19 Collectors (java.util.stream.Collectors)19 StringUtils (org.apache.commons.lang3.StringUtils)16 Logger (org.slf4j.Logger)15 LoggerFactory (org.slf4j.LoggerFactory)15 Set (java.util.Set)14 Pair (org.apache.commons.lang3.tuple.Pair)14 Test (org.junit.Test)14 IOException (java.io.IOException)12 Optional (java.util.Optional)11 Range (org.apache.commons.lang3.Range)11 Date (java.util.Date)10 HashSet (java.util.HashSet)9 ExecutorService (java.util.concurrent.ExecutorService)9 Collection (java.util.Collection)8 Stream (java.util.stream.Stream)8 Lists (com.google.common.collect.Lists)7