Revision: 8706
http://languagetool.svn.sourceforge.net/languagetool/?rev=8706&view=rev
Author: dnaber
Date: 2012-12-29 21:39:02 +0000 (Sat, 29 Dec 2012)
Log Message:
-----------
small clean ups, incl. whitespace
Modified Paths:
--------------
trunk/JLanguageTool/src/test/java/org/languagetool/rules/CompoundRuleTestAbs.java
trunk/JLanguageTool/src/test/java/org/languagetool/rules/de/CompoundRuleTest.java
trunk/JLanguageTool/src/test/java/org/languagetool/rules/ro/CompoundRuleTest.java
Modified:
trunk/JLanguageTool/src/test/java/org/languagetool/rules/CompoundRuleTestAbs.java
===================================================================
---
trunk/JLanguageTool/src/test/java/org/languagetool/rules/CompoundRuleTestAbs.java
2012-12-29 20:39:21 UTC (rev 8705)
+++
trunk/JLanguageTool/src/test/java/org/languagetool/rules/CompoundRuleTestAbs.java
2012-12-29 21:39:02 UTC (rev 8706)
@@ -19,17 +19,17 @@
package org.languagetool.rules;
import java.io.IOException;
+import java.util.Arrays;
import junit.framework.TestCase;
import org.languagetool.JLanguageTool;
/**
- * Abstract test case for CompoundRule. <br/>
+ * Abstract test case for CompoundRule.
* Based on an original version for [en] and [pl].
*
* @author Daniel Naber
- *
*/
public abstract class CompoundRuleTestAbs extends TestCase {
@@ -49,22 +49,22 @@
/**
* Check the text against the compound rule.
- * @param expectedErrors the number of expected errors.
- * @param text the text to check.
- * @param expSuggestions the expected suggestions.
- * @throws IOException thrown by JLanguageTool.
+ * @param expectedErrors the number of expected errors
+ * @param text the text to check
+ * @param expSuggestions the expected suggestions
*/
public void check(int expectedErrors, String text, String[] expSuggestions)
throws IOException {
assertNotNull("Please initialize langTool!", langTool);
assertNotNull("Please initialize 'rule'!", rule);
final RuleMatch[] ruleMatches =
rule.match(langTool.getAnalyzedSentence(text));
- assertEquals(expectedErrors, ruleMatches.length);
+ assertEquals("Expected " + expectedErrors + "errors, but got: " +
Arrays.toString(ruleMatches),
+ expectedErrors, ruleMatches.length);
if (expSuggestions != null && expectedErrors != 1) {
throw new RuntimeException("Sorry, test case can only check suggestion
if there's one rule match");
}
if (expSuggestions != null) {
- final RuleMatch ruleMatch = ruleMatches[0];
- assertEquals(String.format("Got these suggestions: %s, expected %d ",
ruleMatch.getSuggestedReplacements(), expSuggestions.length),
+ final RuleMatch ruleMatch = ruleMatches[0];
+ assertEquals(String.format("Got these suggestions: %s, expected %s ",
ruleMatch.getSuggestedReplacements(), Arrays.toString(expSuggestions)),
expSuggestions.length, ruleMatch.getSuggestedReplacements().size());
int i = 0;
for (final Object element : ruleMatch.getSuggestedReplacements()) {
Modified:
trunk/JLanguageTool/src/test/java/org/languagetool/rules/de/CompoundRuleTest.java
===================================================================
---
trunk/JLanguageTool/src/test/java/org/languagetool/rules/de/CompoundRuleTest.java
2012-12-29 20:39:21 UTC (rev 8705)
+++
trunk/JLanguageTool/src/test/java/org/languagetool/rules/de/CompoundRuleTest.java
2012-12-29 21:39:02 UTC (rev 8706)
@@ -47,6 +47,8 @@
check(0, "Nur im Stand-by-Betrieb");
check(0, "Start, Ziel, Sieg");
check(0, "Roll-on-roll-off-Schiff");
+ check(0, "Halswirbelsäule");
+ check(0, "Hals-Wirbel-Säule"); // doubtful whether this is correct...
// incorrect sentences:
check(1, "System Administrator", new String[]{"System-Administrator",
"Systemadministrator"});
check(1, "bla bla bla bla bla System Administrator bla bla bla bla bla");
@@ -64,6 +66,8 @@
check(2, "Der dumme System Administrator legt die CD ROM.");
check(2, "Der dumme System Administrator legt die CD ROM ein blah");
check(2, "System Administrator CD ROM");
+ check(2, "Hals Wirbel Säule");
+ // TODO: check(1, "Und herum zu knobeln können.", new
String[]{"herumzuknobeln"});
//FIXME: suggestions / longest match
//check(1, "Roll on roll off Schiff", new
String[]{"Roll-on-roll-off-Schiff"});
check(1, "Spin off");
Modified:
trunk/JLanguageTool/src/test/java/org/languagetool/rules/ro/CompoundRuleTest.java
===================================================================
---
trunk/JLanguageTool/src/test/java/org/languagetool/rules/ro/CompoundRuleTest.java
2012-12-29 20:39:21 UTC (rev 8705)
+++
trunk/JLanguageTool/src/test/java/org/languagetool/rules/ro/CompoundRuleTest.java
2012-12-29 21:39:02 UTC (rev 8706)
@@ -32,22 +32,22 @@
*/
public class CompoundRuleTest extends CompoundRuleTestAbs {
- protected void setUp() throws Exception {
- super.setUp();
- langTool = new JLanguageTool(Language.ROMANIAN);
- rule = new CompoundRule(TestTools.getMessages("ro"));
- }
+ protected void setUp() throws Exception {
+ super.setUp();
+ langTool = new JLanguageTool(Language.ROMANIAN);
+ rule = new CompoundRule(TestTools.getMessages("ro"));
+ }
- public void testRule() throws IOException {
- // correct sentences:
- check(0, "Au plecat câteșitrei.");
- // incorrect sentences:
- check(1, "câte și trei", new String[] { "câteșitrei" });
- check(1, "Câte și trei", new String[] { "Câteșitrei" });
- check(1, "câte-și-trei", new String[] { "câteșitrei" });
-
- check(1, "tus trei", new String[] { "tustrei" });
- check(1, "tus-trei", new String[] { "tustrei" });
- }
+ public void testRule() throws IOException {
+ // correct sentences:
+ check(0, "Au plecat câteșitrei.");
+ // incorrect sentences:
+ check(1, "câte și trei", new String[] { "câteșitrei" });
+ check(1, "Câte și trei", new String[] { "Câteșitrei" });
+ check(1, "câte-și-trei", new String[] { "câteșitrei" });
+ check(1, "tus trei", new String[] { "tustrei" });
+ check(1, "tus-trei", new String[] { "tustrei" });
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
_______________________________________________
Languagetool-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-commits