Revision: 7851
          
http://languagetool.svn.sourceforge.net/languagetool/?rev=7851&view=rev
Author:   dnaber
Date:     2012-08-12 21:16:29 +0000 (Sun, 12 Aug 2012)
Log Message:
-----------
small code cleanup

Modified Paths:
--------------
    trunk/JLanguageTool/src/test/org/languagetool/MainTest.java

Modified: trunk/JLanguageTool/src/test/org/languagetool/MainTest.java
===================================================================
--- trunk/JLanguageTool/src/test/org/languagetool/MainTest.java 2012-08-12 
21:06:07 UTC (rev 7850)
+++ trunk/JLanguageTool/src/test/org/languagetool/MainTest.java 2012-08-12 
21:16:29 UTC (rev 7851)
@@ -179,11 +179,8 @@
       Main.main(args);
       String output = new String(this.out.toByteArray());
       assertTrue(output.contains("<error fromy=\"4\" fromx=\"5\" toy=\"4\" 
tox=\"10\" ruleId=\"ENGLISH_WORD_REPEAT_RULE\" msg=\"Possible typo: you 
repeated a word\" replacements=\"is\" context=\"This is is a test of language 
tool. \" contextoffset=\"5\" errorlength=\"5\"/>"));
-    
   }
     
-      
-  
   //test line mode vs. para mode
   //first line mode
   public void testEnglishLineMode() throws Exception {
@@ -285,13 +282,8 @@
   }
   
   public void testGermanFileWithURL() throws Exception {
+      File input = populateFile("Ward ihr zufrieden damit?");
 
-           File input = createTempFile();
-           // Populate the file with data.
-           PrintWriter w = new PrintWriter(new OutputStreamWriter(new 
FileOutputStream(input), "UTF-8"));
-           w.println("Ward ihr zufrieden damit?");
-           w.close();
-
            String[] args = new String[] {"-l", "de", "--api", 
input.getAbsolutePath()};
 
            Main.main(args);
@@ -310,13 +302,8 @@
  
   
   public void testPolishFileAPI() throws Exception {
-    File input = createTempFile();
+    File input = populateFile("To jest świnia która się ślini.");
 
-    // Populate the file with data.
-    PrintWriter w = new PrintWriter(new OutputStreamWriter(new 
FileOutputStream(input), "UTF-8"));
-    w.println("To jest świnia która się ślini.");
-    w.close();
-
     String[] args = new String[] {"-l", "pl", "--api", "-c", "utf-8", 
input.getAbsolutePath()};
 
     Main.main(args);
@@ -329,19 +316,16 @@
   }
   
   public void testPolishLineNumbers() throws Exception {
-    File input = createTempFile();
 
-    // Populate the file with data.
-    PrintWriter w = new PrintWriter(new OutputStreamWriter(new 
FileOutputStream(input), "UTF-8"));
-    w.println("Test.");
-    w.println("Test.");
-    w.println("Test.");
-    w.println("Test.");
-    w.println("Test.");
-    w.println("Test.");
-    w.println("");
-    w.println("Test który wykaże błąd.");
-    w.close();
+    File input = populateFile(
+      "Test.\n" +
+      "Test.\n" +
+      "Test.\n" +
+      "Test.\n" +
+      "Test.\n" +
+      "Test.\n" +
+      "\n" +
+      "Test który wykaże błąd.");
 
     String[] args = new String[] {"-l", "pl", "-c", "utf-8", 
input.getAbsolutePath()};
 
@@ -368,15 +352,11 @@
   }
 
   public void testBitextMode() throws Exception {
-    File input = createTempFile();
+    File input = populateFile(
+      "This is not actual.\tTo nie jest aktualne.\n" +
+      "Test\tTest\n" +
+      "ab\tVery strange data indeed, much longer than input");
 
-    // Populate the file with data.
-    PrintWriter w = new PrintWriter(new OutputStreamWriter(new 
FileOutputStream(input), "UTF-8"));
-    w.println("This is not actual.\tTo nie jest aktualne.");
-    w.println("Test\tTest");
-    w.println("ab\tVery strange data indeed, much longer than input");
-    w.close();
-
     String[] args = new String[] {"-l", "pl", "--bitext", "-m", "en", 
input.getAbsolutePath()};
     Main.main(args);
     String output = new String(this.out.toByteArray());
@@ -387,15 +367,11 @@
   }
   
   public void testBitextModeWithDisabledRule() throws Exception {
-    File input = createTempFile();
+    File input = populateFile(
+      "this is not actual.\tTo nie jest aktualne.\n" +
+      "test\tTest\n" +
+      "ab\tVery strange data indeed, much longer than input");
 
-    // Populate the file with data.
-    PrintWriter w = new PrintWriter(new OutputStreamWriter(new 
FileOutputStream(input), "UTF-8"));
-    w.println("this is not actual.\tTo nie jest aktualne.");
-    w.println("test\tTest");
-    w.println("ab\tVery strange data indeed, much longer than input");
-    w.close();
-
     String[] args = new String[] {"-l", "pl", "--bitext", "-m", "en", "-d", 
"UPPERCASE_SENTENCE_START,TRANSLATION_LENGTH", input.getAbsolutePath()};
     Main.main(args);
     String output = new String(this.out.toByteArray());
@@ -406,15 +382,11 @@
   }
   
   public void testBitextModeWithEnabledRule() throws Exception {
-    File input = createTempFile();
+    File input = populateFile(
+      "this is not actual.\tTo nie jest aktualne.\n" +
+      "test\tTest\n" +
+      "ab\tVery strange data indeed, much longer than input");
 
-    // Populate the file with data.
-    PrintWriter w = new PrintWriter(new OutputStreamWriter(new 
FileOutputStream(input), "UTF-8"));
-    w.println("this is not actual.\tTo nie jest aktualne.");
-    w.println("test\tTest");
-    w.println("ab\tVery strange data indeed, much longer than input");
-    w.close();
-
     String[] args = new String[] {"-l", "pl", "--bitext", "-m", "en", "-e", 
"TRANSLATION_LENGTH", input.getAbsolutePath()};
     Main.main(args);
     String output = new String(this.out.toByteArray());
@@ -425,12 +397,7 @@
   }
   
   public void testBitextModeApply() throws Exception {
-    File input = createTempFile();
-    // Populate the file with data.
-    PrintWriter w = new PrintWriter(new OutputStreamWriter(new 
FileOutputStream(input), "UTF-8"));
-    w.println("There is a dog.\tNie ma psa.");    
-    w.close();
-
+    File input = populateFile("There is a dog.\tNie ma psa.");
     String[] args = new String[] {"-l", "pl", "--bitext", "-m", "en", 
"--apply", input.getAbsolutePath()};
     Main.main(args);
     String output = new String(this.out.toByteArray());
@@ -458,11 +425,7 @@
   }
   
   public void testLangWithCountryVariant() throws Exception {
-    File input = createTempFile();
-    // Populate the file with data.
-    PrintWriter w = new PrintWriter(new OutputStreamWriter(new 
FileOutputStream(input), "UTF-8"));
-    w.println("This is modelling.");
-    w.close();
+    File input = populateFile("This is modelling.");
     String[] args = new String[] {"-l", "en-US", input.getAbsolutePath()};
     Main.main(args);
     String output = new String(this.out.toByteArray());

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
Languagetool-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/languagetool-cvs

Reply via email to