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

import java.io.IOException;
import java.util.Arrays;

import junit.framework.TestCase;

import org.languagetool.AnalyzedToken;

public class PolishSynthesizerTest extends TestCase {
  private AnalyzedToken dummyToken(String tokenStr) {
    return new AnalyzedToken(tokenStr, tokenStr, tokenStr);
  }

  public final void testSynthesizeString() throws IOException {
    PolishSynthesizer synth = new PolishSynthesizer();
    assertEquals(synth.synthesize(dummyToken("blablabla"), "blablabla").length, 0);

    assertEquals("[Aarona]", Arrays.toString(synth.synthesize(dummyToken("Aaron"), "subst:sg:gen:m1")));
    assertEquals("[Abchazem]", Arrays.toString(synth.synthesize(dummyToken("Abchaz"), "subst:sg:inst:m1")));
    // assertEquals("[nieduży]", Arrays.toString(synth.synthesize(dummyToken("nieduży"), "adj:sg:nom:m:pos:neg")));        
    assertEquals("[miała]", Arrays.toString(synth.synthesize(dummyToken("mieć"), "verb:praet:sg:f:ter:imperf:refl.nonrefl")));
        assertEquals("[brzydziej]", Arrays.toString(synth.synthesize(dummyToken("brzydko"), "adv:com")));
    //with regular expressions
    assertEquals("[tonera]", Arrays.toString(synth.synthesize(dummyToken("toner"), "subst:sg:gen:m.*", true)));
    assertEquals("[nieduży, niedużego]", Arrays.toString(synth.synthesize(dummyToken("nieduży"), "adj:sg.*(m[0-9]?|m.n):pos", true)));    
    assertEquals("[miałaś, miałam, miała, miał, miałeś, miało, miałobyś, miałobym, miałem, miałabym, miałabyś, miałbym, miałoby, miałbyś, miałby, miałoś, miałaby, miałom]", 
          Arrays.toString(synth.synthesize(dummyToken("mieć"), ".*praet:sg.*", true)));
  }

}

@@ -2039,32 +2039,60 @@
 Arrays.toString(
+%0A            getSortedArray(
 synth.synthesize
@@ -2136,24 +2136,25 @@
 .*%22, true)))
+)
 ;%0A    assert
@@ -2172,17 +2172,19 @@
 edu%C5%BC
-y
+ego
 , niedu%C5%BC
 ego%5D
@@ -2179,19 +2179,17 @@
 , niedu%C5%BC
-ego
+y
 %5D%22, Arra
@@ -2192,32 +2192,60 @@
 Arrays.toString(
+%0A            getSortedArray(
 synth.synthesize
@@ -2304,16 +2304,17 @@
  true)))
+)
 ;    %0A  
@@ -2338,18 +2338,8 @@
 mia%C5%82
-a%C5%9B, mia%C5%82am
 , mi
@@ -2351,80 +2351,96 @@
 mia%C5%82
+aby, mia%C5%82abym
 , mia%C5%82
-e
+aby
 %C5%9B, mia%C5%82
-o
+am
 , mia%C5%82
-oby
+a
 %C5%9B, mia%C5%82
-o
 by
-m
 , mia%C5%82
-e
+by
 m, mia%C5%82
-a
 by
-m
+%C5%9B
 , mia%C5%82
-aby%C5%9B
+em
 , mia%C5%82
-bym
+e%C5%9B, mia%C5%82o
 , mi
@@ -2454,44 +2454,38 @@
 mia%C5%82
-by%C5%9B, mia%C5%82
+o
 by
+m
 , mia%C5%82o
+by
 %C5%9B, mia%C5%82
-aby
+om
 , mia%C5%82o
-m
+%C5%9B
 %5D%22, 
@@ -2503,32 +2503,66 @@
 Arrays.toString(
+%0A                  getSortedArray(
 synth.synthesize
@@ -2605,17 +2605,155 @@
  true)))
+)
 ;%0A  %7D%0A%0A
+  private String%5B%5D getSortedArray(String%5B%5D ar) %7B%0A      String%5B%5D newAr = ar.clone();%0A      Arrays.sort(newAr);%0A      return newAr;%0A  %7D%0A  %0A
 %7D%0A

change tests to see if that helps with undefined order of return data