@@ -0,0 +1,2830 @@
+/* LanguageTool, a natural language style checker %0A * Copyright (C) 2005 Daniel Naber (http://www.danielnaber.de)%0A * %0A * This library is free software; you can redistribute it and/or%0A * modify it under the terms of the GNU Lesser General Public%0A * License as published by the Free Software Foundation; either%0A * version 2.1 of the License, or (at your option) any later version.%0A *%0A * This library is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU%0A * Lesser General Public License for more details.%0A *%0A * You should have received a copy of the GNU Lesser General Public%0A * License along with this library; if not, write to the Free Software%0A * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301%0A * USA%0A */%0Apackage org.languagetool.rules.de;%0A%0Aimport org.junit.Test;%0Aimport org.languagetool.JLanguageTool;%0Aimport org.languagetool.TestTools;%0Aimport org.languagetool.UserConfig;%0Aimport org.languagetool.language.German;%0Aimport org.languagetool.rules.Rule;%0A%0Aimport java.io.IOException;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0A/**%0A * @author Fred Kruse%0A */%0Apublic class GermanFillerWordsRuleTest %7B%0A%0A  @Test%0A  public void testRule() throws IOException %7B%0A    JLanguageTool lt = new JLanguageTool(new German());%0A    setUpRule(lt, null);%0A%0A    //  more than 8%25 filler words (default)%0A    assertEquals(1, lt.check(%22Der Satz enth%C3%A4lt augenscheinlich ein F%C3%BCllwort.%22).size());%0A    assertEquals(2, lt.check(%22Der Satz enth%C3%A4lt augenscheinlich relativ viele F%C3%BCllw%C3%B6rter.%22).size());%0A    //  less than 8%25 filler words - don't show them%0A    assertEquals(0, lt.check(%22Der Satz enth%C3%A4lt augenscheinlich ein F%C3%BCllwort, aber es sind nicht genug um angezeigt zu werden.%22).size());%0A    //  direct speach or citation - don't show filler words%0A    assertEquals(0, lt.check(%22%C2%BBDer Satz enth%C3%A4lt augenscheinlich ein F%C3%BCllwort%C2%AB%22).size());%0A    %0A    //  percentage set to zero - show all filler words%0A    Map%3CString, Integer%3E ruleValues = new HashMap%3C%3E();%0A    ruleValues.put(%22FILLER_WORDS_DE%22, 0);%0A    UserConfig userConfig = new UserConfig(ruleValues);%0A    setUpRule(lt, userConfig);%0A    assertEquals(1, lt.check(%22%C2%BBDer Satz enth%C3%A4lt augenscheinlich ein F%C3%BCllwort%C2%AB%22).size());%0A    assertEquals(1, lt.check(%22Der Satz enth%C3%A4lt augenscheinlich ein F%C3%BCllwort, aber es sind nicht genug um angezeigt zu werden.%22).size());%0A  %7D%0A%0A  private void setUpRule(JLanguageTool lt, UserConfig userConfig) %7B%0A    for (Rule rule : lt.getAllRules()) %7B%0A      lt.disableRule(rule.getId());%0A    %7D%0A    GermanFillerWordsRule rule = %0A        new GermanFillerWordsRule(TestTools.getMessages(new German().getShortCode()), userConfig);%0A    lt.addRule(rule);%0A    lt.enableRule(rule.getId());%0A  %7D%0A%0A%7D%0A

add test for GermanFillerWordsRule (tests also AbstractFillerWordsRule) - solves issue #1149