Search in sources :

Example 1 with TextBelongsToBlackListChecker

use of org.asqatasun.rules.elementchecker.text.TextBelongsToBlackListChecker in project Asqatasun by Asqatasun.

the class LinkTitlePertinenceChecker method addCheckers.

/**
 */
private void addCheckers() {
    ElementChecker ec = new TextEmptinessChecker(titleAttrElementBuilder, EMPTY_LINK_TITLE_MSG, null, getEeAttributeNames());
    ec.setTextElementBuilder(linkTextElementBuilder);
    addChecker(ec);
    ec = new TextOnlyContainsNonAlphanumericalCharactersChecker(titleAttrElementBuilder, getFailureSolution(), NOT_PERTINENT_LINK_TITLE_MSG, getEeAttributeNames());
    ec.setTextElementBuilder(linkTextElementBuilder);
    addChecker(ec);
    ec = new TextBelongsToBlackListChecker(titleAttrElementBuilder, LINK_TEXT_BL_NOM_NAME, getFailureSolution(), NOT_PERTINENT_LINK_TITLE_MSG, getEeAttributeNames());
    // this set is used extract linkText
    ec.setTextElementBuilder(linkTextElementBuilder);
    addChecker(ec);
    TestSolution strictCheckerSolution = TestSolution.FAILED;
    String strictCheckerMsg = NOT_PERTINENT_LINK_TITLE_MSG;
    if (isEqualContentAuthorized) {
        strictCheckerSolution = NEED_MORE_INFO;
        strictCheckerMsg = SUSPECTED_PERTINENT_LINK_TITLE_MSG;
    }
    TextNotIdenticalToAttributeChecker strictChecker = new TextNotIdenticalToAttributeChecker(getTextElementBuilder(), titleAttrElementBuilder, new ImmutablePair<>(strictCheckerSolution, strictCheckerMsg), new ImmutablePair<>(PASSED, ""), getEeAttributeNames());
    strictChecker.setStrictEquality(true);
    strictChecker.setTextElementBuilder(linkTextElementBuilder);
    addChecker(strictChecker);
    ElementChecker containChecker = new TextNotIdenticalToAttributeChecker(getTextElementBuilder(), titleAttrElementBuilder, new ImmutablePair<>(NEED_MORE_INFO, SUSPECTED_PERTINENT_LINK_TITLE_MSG), new ImmutablePair<>(NEED_MORE_INFO, SUSPECTED_NOT_PERTINENT_LINK_TITLE_MSG), getEeAttributeNames());
    containChecker.setTextElementBuilder(linkTextElementBuilder);
    addChecker(containChecker);
}
Also used : TextBelongsToBlackListChecker(org.asqatasun.rules.elementchecker.text.TextBelongsToBlackListChecker) TextNotIdenticalToAttributeChecker(org.asqatasun.rules.elementchecker.text.TextNotIdenticalToAttributeChecker) TextEmptinessChecker(org.asqatasun.rules.elementchecker.text.TextEmptinessChecker) TestSolution(org.asqatasun.entity.audit.TestSolution) TextOnlyContainsNonAlphanumericalCharactersChecker(org.asqatasun.rules.elementchecker.text.TextOnlyContainsNonAlphanumericalCharactersChecker) ElementChecker(org.asqatasun.rules.elementchecker.ElementChecker)

Aggregations

TestSolution (org.asqatasun.entity.audit.TestSolution)1 ElementChecker (org.asqatasun.rules.elementchecker.ElementChecker)1 TextBelongsToBlackListChecker (org.asqatasun.rules.elementchecker.text.TextBelongsToBlackListChecker)1 TextEmptinessChecker (org.asqatasun.rules.elementchecker.text.TextEmptinessChecker)1 TextNotIdenticalToAttributeChecker (org.asqatasun.rules.elementchecker.text.TextNotIdenticalToAttributeChecker)1 TextOnlyContainsNonAlphanumericalCharactersChecker (org.asqatasun.rules.elementchecker.text.TextOnlyContainsNonAlphanumericalCharactersChecker)1