/* LanguageTool, a natural language style checker 
 * Copyright (C) 2005 Daniel Naber (http://www.danielnaber.de)
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
 * USA
 */

package org.languagetool.rules.pl;

import junit.framework.TestCase;
import org.languagetool.JLanguageTool;
import org.languagetool.language.Polish;
import org.languagetool.rules.RuleMatch;

import java.io.IOException;

public class PolishWordRepeatRuleTest extends TestCase {

  /*
   * Test method for 'org.languagetool.rules.pl.PolishWordRepeatRule.match(AnalyzedSentence)'
   */
  public void testRule() throws IOException {
    final PolishWordRepeatRule rule = new PolishWordRepeatRule(null);
    RuleMatch[] matches;
    JLanguageTool langTool = new JLanguageTool(new Polish());
    //correct
    matches = rule.match(langTool.getAnalyzedSentence("To jest zdanie próbne."));
    assertEquals(0, matches.length);
    //repeated prepositions, don't count'em
    matches = rule.match(langTool.getAnalyzedSentence("Na dyskotece tańczył jeszcze, choć był na bani."));
    assertEquals(0, matches.length);
    // sf bug report:
    matches = rule.match(langTool.getAnalyzedSentence("Żadnych „ale”."));
    assertEquals(0, matches.length);
    //incorrect
    matches = rule.match(langTool.getAnalyzedSentence("Był on bowiem pięknym strzelcem bowiem."));
    assertEquals(1, matches.length);
    matches = rule.match(langTool.getAnalyzedSentence("Mówiła długo, żeby tylko mówić długo."));
    assertEquals(2, matches.length);
  }

}

@@ -1570,24 +1570,180 @@
 es.length);%0A
+    matches = rule.match(langTool.getAnalyzedSentence(%22On tak si%C4%99 bardzo nie martwi%C5%82, bo przecie%C5%BC musia%C5%82 si%C4%99 umy%C4%87.%22));%0A    assertEquals(0, matches.length);%0A
     //repeat

add a test