@@ -0,0 +1,1864 @@
+/* LanguageTool, a natural language style checker%0A * Copyright (C) 2015 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;%0A%0Aimport org.junit.Test;%0Aimport org.languagetool.language.AmericanEnglish;%0Aimport org.languagetool.rules.Rule;%0Aimport org.languagetool.rules.spelling.SpellingCheckRule;%0A%0Aimport java.io.IOException;%0Aimport java.util.Arrays;%0Aimport java.util.List;%0A%0Aimport static org.hamcrest.MatcherAssert.assertThat;%0Aimport static org.hamcrest.core.Is.is;%0A%0Apublic class SpellIgnoreTest %7B%0A  %0A  // code also used in http://wiki.languagetool.org/java-api%0A  @Test%0A  public void testIgnore() throws IOException %7B%0A    String text = %22This is a text with specialword and myotherword%22;%0A    JLanguageTool lt = new JLanguageTool(new AmericanEnglish());%0A    assertThat(lt.check(text).size(), is(2));%0A    for (Rule rule : lt.getAllActiveRules()) %7B%0A      if (rule instanceof SpellingCheckRule) %7B%0A        List%3CString%3E wordsToIgnore = Arrays.asList(%22specialword%22, %22myotherword%22);%0A        ((SpellingCheckRule)rule).addIgnoreTokens(wordsToIgnore);%0A      %7D%0A    %7D%0A    assertThat(lt.check(text).size(), is(0));%0A  %7D%0A%0A%7D%0A

check that ignoring words works as documented in our wiki