use of org.asqatasun.rules.elementchecker.text.TextOnlyContainsNonAlphanumericalCharactersChecker 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);
}
Aggregations