@@ -0,0 +1,2536 @@
+/* LanguageTool, a natural language style checker %0A * Copyright (C) 2021 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.JLanguageTool.Level;%0Aimport org.languagetool.JLanguageTool.Mode;%0Aimport org.languagetool.JLanguageTool.ParagraphHandling;%0Aimport org.languagetool.language.French;%0Aimport org.languagetool.markup.AnnotatedText;%0Aimport org.languagetool.markup.AnnotatedTextBuilder;%0Aimport org.languagetool.rules.RuleMatch;%0A%0Aimport java.io.IOException;%0Aimport java.util.List;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Apublic class JLanguageToolTest %7B%0A%0A  @Test%0A  public void testLanguageDependentFilter() throws IOException %7B%0A    Language lang = new French();%0A    JLanguageTool tool = new JLanguageTool(lang);%0A%0A    // picky mode: suggestions with typographical apostrophes%0A    AnalyzedSentence analyzedSentence = tool.getAnalyzedSentence(%22De homme%22);%0A    AnnotatedText annotatedText = new AnnotatedTextBuilder().addText(analyzedSentence.getText()).build();%0A    RuleMatchListener listener = null;%0A    List%3CRuleMatch%3E matches = tool.check(annotatedText, true, ParagraphHandling.NORMAL, listener, Mode.ALL,%0A        Level.PICKY);%0A    assertEquals(1, matches.size());%0A    assertEquals(%22%5BD%E2%80%99homme%5D%22, matches.get(0).getSuggestedReplacements().toString());%0A%0A    // normal mode: suggestions with straight apostrophes%0A    analyzedSentence = tool.getAnalyzedSentence(%22De homme%22);%0A    annotatedText = new AnnotatedTextBuilder().addText(analyzedSentence.getText()).build();%0A    listener = null;%0A    matches = tool.check(annotatedText, true, ParagraphHandling.NORMAL, listener, Mode.ALL, Level.DEFAULT);%0A    assertEquals(1, matches.size());%0A    assertEquals(%22%5BD'homme%5D%22, matches.get(0).getSuggestedReplacements().toString());%0A%0A  %7D%0A%7D%0A

test for LanguageDependentFilter/picky mode