Revision: 7454
          
http://languagetool.svn.sourceforge.net/languagetool/?rev=7454&view=rev
Author:   milek_pl
Date:     2012-06-22 11:28:30 +0000 (Fri, 22 Jun 2012)
Log Message:
-----------
and a Junit test...

Added Paths:
-----------
    
trunk/JLanguageTool/src/test/org/languagetool/rules/en/MorfologikBritishSpellerRuleTest.java

Added: 
trunk/JLanguageTool/src/test/org/languagetool/rules/en/MorfologikBritishSpellerRuleTest.java
===================================================================
--- 
trunk/JLanguageTool/src/test/org/languagetool/rules/en/MorfologikBritishSpellerRuleTest.java
                                (rev 0)
+++ 
trunk/JLanguageTool/src/test/org/languagetool/rules/en/MorfologikBritishSpellerRuleTest.java
        2012-06-22 11:28:30 UTC (rev 7454)
@@ -0,0 +1,45 @@
+package org.languagetool.rules.en;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import org.junit.Test;
+import org.languagetool.JLanguageTool;
+import org.languagetool.Language;
+import org.languagetool.TestTools;
+import org.languagetool.rules.RuleMatch;
+import 
org.languagetool.rules.spelling.morfologik.pl.MorfologikPolishSpellerRule;
+
+public class MorfologikBritishSpellerRuleTest {
+
+    @Test
+    public void testMorfologikSpeller() throws IOException {
+        MorfologikBritishSpellerRule rule =
+                new MorfologikBritishSpellerRule 
(TestTools.getMessages("English"), Language.BRITISH_ENGLISH);
+
+        RuleMatch[] matches;
+        JLanguageTool langTool = new JLanguageTool(Language.BRITISH_ENGLISH);
+
+
+        // correct sentences:
+        assertEquals(0, rule.match(langTool.getAnalyzedSentence("This is an 
example: we get behaviour as a dictionary word.")).length);
+        assertEquals(0, rule.match(langTool.getAnalyzedSentence("Why don't we 
speak today.")).length);
+        assertEquals(0, rule.match(langTool.getAnalyzedSentence(",")).length);
+        assertEquals(0, 
rule.match(langTool.getAnalyzedSentence("123454")).length);
+
+        //incorrect sentences:
+
+        matches = rule.match(langTool.getAnalyzedSentence("Behavior"));
+        // check match positions:
+        assertEquals(1, matches.length);
+        assertEquals(0, matches[0].getFromPos());
+        assertEquals(8, matches[0].getToPos());
+        assertEquals("behaviour", 
matches[0].getSuggestedReplacements().get(0));
+
+        assertEquals(1, 
rule.match(langTool.getAnalyzedSentence("aõh")).length);
+        assertEquals(0, rule.match(langTool.getAnalyzedSentence("a")).length);
+
+    }
+
+}


Property changes on: 
trunk/JLanguageTool/src/test/org/languagetool/rules/en/MorfologikBritishSpellerRuleTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Languagetool-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-cvs

Reply via email to