gt:     protected final void addBlackListChecker() {
context: /*
   *  Tanaguru - Automated webpage assessment
   *  Copyright (C) 2008-2015  Tanaguru.org
   * 
   *  This file is part of Tanaguru.
   * 
   *  Tanaguru is free software: you can redistribute it and/or modify
   *  it under the terms of the GNU Affero General Public License as
   *  published by the Free Software Foundation, either version 3 of the
   *  License, or (at your option) any later version.
   * 
   *  This program is distributed in the hope that it will be useful,
   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   *  GNU Affero General Public License for more details.
   * 
   *  You should have received a copy of the GNU Affero General Public License
   *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
   * 
   *  Contact us by mail: tanaguru AT tanaguru DOT org
   */
  
  package org.tanaguru.rules.elementchecker.pertinence;
  
  import java.util.Collections;
  import javax.annotation.Nullable;
  import org.apache.commons.lang3.StringUtils;
  import org.apache.commons.lang3.tuple.ImmutablePair;
  import org.tanaguru.entity.audit.TestSolution;
  import org.tanaguru.rules.elementchecker.CompositeChecker;
  import org.tanaguru.rules.elementchecker.text.TextBelongsToBlackListChecker;
  import org.tanaguru.rules.elementchecker.text.TextEmptinessChecker;
  import org.tanaguru.rules.elementchecker.text.TextNotIdenticalToAttributeChecker;
  import org.tanaguru.rules.elementchecker.text.TextOnlyContainsNonAlphanumericalCharactersChecker;
  import org.tanaguru.rules.textbuilder.SimpleTextElementBuilder;
  import org.tanaguru.rules.textbuilder.TextElementBuilder;
  
  /**
   * This class checks whether a text is pertinent by verifying :
   * <ul>
   * <li>it is not empty</li>
   * <li>it is not only composed of non alphanumerical characters</li>
   * <li>it is not blacklisted</li>
   * <li>it is not identical to another text (the content of another attribue
   * for instance)</li>
    *</ul>
   */
  public class TextPertinenceChecker extends CompositeChecker {
  
      /* The element builder needed to retrieve the text to check */
      private TextElementBuilder textElementBuilder;
      @Override
      public TextElementBuilder getTextElementBuilder() {
          if (textElementBuilder == null) {
              textElementBuilder = new SimpleTextElementBuilder();
          }
          return textElementBuilder;
      }
  
      /* check emptiness */
      private boolean checkEmptiness;
      /* attribute name to compare with*/
      private TextElementBuilder textElementBuilderToCompareWith;
      /* blacklist name to compare with*/
      private String blacklistNameToCompareWith = null;
      /* not pertinent message code */
      String notPertinentMessageCode = null;
      /* manual ckeck message code */
      String manualCheckMessage = null;
      
      /**
       * constructor.
       * Enables to override the not pertinent solution.
       * 
       * @param checkEmptiness
       * @param textElementBuilderToCompareWith
       * @param blacklistNameToCompareWith
       * @param notPertinentSolution
       * @param notPertinentMessageCode
       * @param manualCheckMessage
       * @param eeAttributeNameList 
       */
      public TextPertinenceChecker(
              boolean checkEmptiness,
              TextElementBuilder textElementBuilderToCompareWith, 
              String blacklistNameToCompareWith,
              TestSolution notPertinentSolution,
              String notPertinentMessageCode,
              String manualCheckMessage,
              String... eeAttributeNameList) {
          super(notPertinentSolution, eeAttributeNameList);
  
          addCheckMessageFromSolution(
                  TestSolution.PASSED, 
                  Collections.singletonMap(TestSolution.NEED_MORE_INFO, manualCheckMessage));
          
          this.checkEmptiness = checkEmptiness;
          this.textElementBuilderToCompareWith = textElementBuilderToCompareWith;
          this.blacklistNameToCompareWith = blacklistNameToCompareWith;
          this.notPertinentMessageCode = notPertinentMessageCode;
          this.manualCheckMessage = manualCheckMessage;
  
          addCheckers();
      }
      
      /**
       * Constructor.
       * Returns FAILED when the attribute is not pertinent.
       * 
       * @param checkEmptiness
       * @param textElementBuilderToCompareWith
       * @param blacklistNameToCompareWith
       * @param notPertinentMessageCode
       * @param manualCheckMessage
       * @param eeAttributeNameList
       */
      public TextPertinenceChecker(
              boolean checkEmptiness,
              @Nullable TextElementBuilder textElementBuilderToCompareWith, 
              @Nullable String blacklistNameToCompareWith,
              String notPertinentMessageCode,
              String manualCheckMessage,
              String... eeAttributeNameList) {
          this(checkEmptiness, 
               textElementBuilderToCompareWith, 
               blacklistNameToCompareWith, 
               TestSolution.FAILED,
               notPertinentMessageCode,
               manualCheckMessage, 
               eeAttributeNameList);
      }
      
      /**
       * Constructor.
       * Returns FAILED when the attribute is not pertinent.
       * 
       * @param textElementBuilder
       * @param checkEmptiness
       * @param textElementBuilderToCompareWith
       * @param blacklistNameToCompareWith
       * @param notPertinentMessageCode
       * @param manualCheckMessage
       * @param eeAttributeNameList
       */
      public TextPertinenceChecker(
              TextElementBuilder textElementBuilder,
              boolean checkEmptiness,
              @Nullable TextElementBuilder textElementBuilderToCompareWith, 
              @Nullable String blacklistNameToCompareWith,
              String notPertinentMessageCode,
              String manualCheckMessage,
              String... eeAttributeNameList) {
          super(TestSolution.FAILED, eeAttributeNameList);
  
          addCheckMessageFromSolution(
                  TestSolution.PASSED, 
                  Collections.singletonMap(TestSolution.NEED_MORE_INFO, manualCheckMessage));
          
          this.checkEmptiness = checkEmptiness;
          this.textElementBuilderToCompareWith = textElementBuilderToCompareWith;
          this.blacklistNameToCompareWith = blacklistNameToCompareWith;
          this.notPertinentMessageCode = notPertinentMessageCode;
          this.textElementBuilder = textElementBuilder;
          this.manualCheckMessage = manualCheckMessage;
          
          addCheckers();
      }
      
      /**
       * Constructor.
       * Returns notPertinentSolution when the attribute is not pertinent.
       * 
       * @param textElementBuilder
       * @param checkEmptiness
       * @param textElementBuilderToCompareWith
       * @param blacklistNameToCompareWith
       * @param notPertinentSolution
       * @param notPertinentMessageCode
       * @param manualCheckMessage
       * @param eeAttributeNameList
       */
      public TextPertinenceChecker(
              TextElementBuilder textElementBuilder,
              boolean checkEmptiness,
              @Nullable TextElementBuilder textElementBuilderToCompareWith, 
              @Nullable String blacklistNameToCompareWith,
              TestSolution notPertinentSolution,
              String notPertinentMessageCode,
              String manualCheckMessage,
              String... eeAttributeNameList) {
          super(notPertinentSolution, eeAttributeNameList);
  
          addCheckMessageFromSolution(
                  TestSolution.PASSED, 
                  Collections.singletonMap(TestSolution.NEED_MORE_INFO, manualCheckMessage));
          
          this.checkEmptiness = checkEmptiness;
          this.textElementBuilderToCompareWith = textElementBuilderToCompareWith;
          this.blacklistNameToCompareWith = blacklistNameToCompareWith;
          this.notPertinentMessageCode = notPertinentMessageCode;
          this.textElementBuilder = textElementBuilder;
          this.manualCheckMessage = manualCheckMessage;
          
          addCheckers();
      }
  
      /**
       * Constructor.
       * Returns FAILED when the attribute is not pertinent.
       * 
       * @param checkEmptiness
       * @param textElementBuilderToCompareWith
       * @param blacklistNameToCompareWith
       * @param notPertinentMessageCode
       * @param manualCheckMessage
       */
      public TextPertinenceChecker(
              boolean checkEmptiness,
              @Nullable TextElementBuilder textElementBuilderToCompareWith, 
              @Nullable String blacklistNameToCompareWith,
              String notPertinentMessageCode,
              String manualCheckMessage) {
          this(checkEmptiness, 
               textElementBuilderToCompareWith, 
               blacklistNameToCompareWith, 
               TestSolution.FAILED,
               notPertinentMessageCode,
               manualCheckMessage);
      }
      
      /**
       * Add all the checkers to the checker collection
       */
      private void addCheckers() {
          addTextEmptinessChecker();
          addBlackListChecker();
          addTextNonAlphanumChecker();
          addAttributeComparisonChecker();
  //    	super.setIsOrCombinaison(false);
      }
      
   
      
      /**
       * Add a {@link TextEmptinessChecker} to the checker collection
       */
      protected final void addTextEmptinessChecker() {
          // The first check, when requested, is the consists in verifying
          // the element content emptiness
          if (checkEmptiness) {
  	        addChecker(new TextEmptinessChecker(
  	                getTextElementBuilder(),
  	                new ImmutablePair(getFailureSolution(), notPertinentMessageCode), 
  	                new ImmutablePair(TestSolution.PASSED,""), 
  	                getEeAttributeNames()));
          }else {
          	//permits to allowed emptiness elements, for decoratives images, for example
          	addChecker(new TextEmptinessChecker(
                  getTextElementBuilder(),
                  new ImmutablePair(TestSolution.NEED_MORE_INFO,manualCheckMessage), 
                  new ImmutablePair(TestSolution.PASSED,""), 
                  getEeAttributeNames()));
          }
      }
  
      /**
       * Add a {@link TextBelongsToBlackListChecker} to the checker collection
       */
  