/* LanguageTool, a natural language style checker
 * Copyright (C) 2014 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.es;

import org.junit.BeforeClass;
import org.junit.Test;
import org.languagetool.JLanguageTool;
import org.languagetool.TestTools;
import org.languagetool.language.Spanish;
import org.languagetool.rules.RuleMatch;

import java.io.IOException;

import static org.junit.Assert.assertEquals;

public class MorfologikSpanishSpellerRuleTest {

  private static final Spanish language = new Spanish();

  private static MorfologikSpanishSpellerRule rule;
  private static JLanguageTool langTool;

  @BeforeClass
  public static void setup() throws IOException {
    rule = new MorfologikSpanishSpellerRule(TestTools.getMessages("en"), language);
    langTool = new JLanguageTool(language);
  }

  @Test
  public void testMorfologikSpeller() throws IOException {
    assertEquals(0, rule.match(langTool.getAnalyzedSentence("Escriba un texto aquí. LanguageTool le ayudará a afrontar algunas dificultades propias de la escritura.")).length);
    
    RuleMatch[] matches = rule.match(langTool.getAnalyzedSentence("Se a hecho un esfuerzo para detectar errores tipográficos, ortograficos y incluso gramaticales."));
    assertEquals(1, matches.length);
    assertEquals(59, matches[0].getFromPos());
    assertEquals(71, matches[0].getToPos());
    assertEquals("ortográficos", matches[0].getSuggestedReplacements().get(0));
  }

}

@@ -893,38 +893,8 @@
 s;%0A%0A
-import org.junit.BeforeClass;%0A
 impo
@@ -1200,28 +1200,76 @@
 %0A%0A  
-priva
+@Test%0A  public void 
 te
- 
 st
-atic final
+MorfologikSpeller() throws IOException %7B%0A   
  Spa
@@ -1299,33 +1299,19 @@
 nish();%0A
-%0A
   
-private static
+ 
  Morfolo
@@ -1336,125 +1336,8 @@
 ule 
-rule;%0A  private static JLanguageTool langTool;%0A%0A  @BeforeClass%0A  public static void setup() throws IOException %7B%0A    
 rule
@@ -1416,16 +1416,30 @@
 e);%0A    
+JLanguageTool 
 langTool
@@ -1474,79 +1474,8 @@
 e);%0A
-  %7D%0A%0A  @Test%0A  public void testMorfologikSpeller() throws IOException %7B
 %0A   

simplify test code a bit