/* 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.de;

import junit.framework.TestCase;
import org.languagetool.JLanguageTool;
import org.languagetool.language.German;

import java.io.IOException;

/**
 * @author Daniel Naber
 */
public class WiederVsWiderRuleTest extends TestCase {

  public void testRule() throws IOException {
    WiederVsWiderRule rule = new WiederVsWiderRule(null);
    JLanguageTool langTool = new JLanguageTool(new German());
    // correct sentences:
    assertEquals(0, rule.match(langTool.getAnalyzedSentence("Das spiegelt wider, wie es wieder läuft.")).length);
    assertEquals(0, rule.match(langTool.getAnalyzedSentence("Das spiegelt die Situation gut wider.")).length);
    assertEquals(0, rule.match(langTool.getAnalyzedSentence("Das spiegelt die Situation.")).length);
    assertEquals(0, rule.match(langTool.getAnalyzedSentence("Immer wieder spiegelt das die Situation.")).length);
    assertEquals(0, rule.match(langTool.getAnalyzedSentence("Immer wieder spiegelt das die Situation wider.")).length);
    assertEquals(0, rule.match(langTool.getAnalyzedSentence("Das spiegelt wieder wider, wie es läuft.")).length);
    // errors:
    assertEquals(1, rule.match(langTool.getAnalyzedSentence("Das spiegelt wieder, wie es wieder läuft.")).length);
    assertEquals(1, rule.match(langTool.getAnalyzedSentence("Das spiegelt die Situation gut wieder.")).length);
    assertEquals(1, rule.match(langTool.getAnalyzedSentence("Immer wieder spiegelt das die Situation wieder.")).length);
  }
    
}

@@ -1127,54 +1127,20 @@
 %0A  p
-ublic void testRule() throws IOException %7B%0A   
+rivate final
  Wie
@@ -1189,16 +1189,63 @@
 e(null);
+%0A%0A  public void testRule() throws IOException %7B
 %0A    JLa
@@ -1256,23 +1256,17 @@
 geTool l
-angTool
+t
  = new J
@@ -1333,57 +1333,12 @@
 sert
-Equals(0, rule.match(langTool.getAnalyzedSentence
+Good
 (%22Da
@@ -1372,33 +1372,28 @@
 eder l%C3%A4uft.%22
-)).length
+, lt
 );%0A    asser
@@ -1397,57 +1397,12 @@
 sert
-Equals(0, rule.match(langTool.getAnalyzedSentence
+Good
 (%22Da
@@ -1433,33 +1433,28 @@
  gut wider.%22
-)).length
+, lt
 );%0A    asser
@@ -1458,57 +1458,12 @@
 sert
-Equals(0, rule.match(langTool.getAnalyzedSentence
+Good
 (%22Da
@@ -1484,33 +1484,28 @@
  Situation.%22
-)).length
+, lt
 );%0A    asser
@@ -1509,57 +1509,12 @@
 sert
-Equals(0, rule.match(langTool.getAnalyzedSentence
+Good
 (%22Im
@@ -1552,25 +1552,20 @@
 uation.%22
-)).length
+, lt
 );%0A    a
@@ -1573,57 +1573,12 @@
 sert
-Equals(0, rule.match(langTool.getAnalyzedSentence
+Good
 (%22Im
@@ -1618,33 +1618,28 @@
 tion wider.%22
-)).length
+, lt
 );%0A    asser
@@ -1643,57 +1643,12 @@
 sert
-Equals(0, rule.match(langTool.getAnalyzedSentence
+Good
 (%22Da
@@ -1682,33 +1682,28 @@
 e es l%C3%A4uft.%22
-)).length
+, lt
 );%0A    // er
@@ -1722,57 +1722,11 @@
 sert
-Equals(1, rule.match(langTool.getAnalyzedSentence
+Bad
 (%22Da
@@ -1765,25 +1765,20 @@
  l%C3%A4uft.%22
-)).length
+, lt
 );%0A    a
@@ -1786,62 +1786,222 @@
 sert
-Equals(1, rule.match(langTool.getAnalyzedSentence(%22Das
+Bad(%22Sie spiegeln das Wachstum der Stadt wieder.%22, lt);%0A    assertBad(%22Das spiegelt die Situation gut wieder.%22, lt);%0A    assertBad(%22Immer wieder spiegelt das die Situation wieder.%22, lt);%0A    assertBad(%22Immer wieder
  spi
@@ -1997,32 +1997,37 @@
  wieder spiegelt
+e das
  die Situation g
@@ -2025,28 +2025,24 @@
 tuation 
-gut 
 wieder.%22
 )).lengt
@@ -2033,27 +2033,111 @@
 wieder.%22
-)).length);
+, lt);%0A  %7D%0A%0A  private void assertGood(String text, JLanguageTool langTool) throws IOException %7B
 %0A    ass
@@ -2146,17 +2146,17 @@
 tEquals(
-1
+0
 , rule.m
@@ -2193,57 +2193,176 @@
 nce(
-%22Immer wieder spiegelt das die Situation wieder.%22
+text)).length);%0A  %7D%0A%0A  private void assertBad(String text, JLanguageTool langTool) throws IOException %7B%0A    assertEquals(1, rule.match(langTool.getAnalyzedSentence(text
 )).l
@@ -2373,15 +2373,11 @@
 h);%0A  %7D%0A
-    
 %0A%7D%0A

improve test