package de.danielnaber.languagetool.synthesis.en;

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

import junit.framework.TestCase;
import de.danielnaber.languagetool.AnalyzedToken;

public class EnglishSynthesizerTest extends TestCase {

  private final AnalyzedToken dummyToken(String tokenStr) {
    return new AnalyzedToken(tokenStr, tokenStr, tokenStr);
  }
  public final void testSynthesizeStringString() throws IOException {
    EnglishSynthesizer synth = new EnglishSynthesizer();
    assertNull(synth.synthesize(dummyToken("blablabla"), 
        "blablabla"));
    
    assertEquals("[were, wast, was]", Arrays.toString(synth.synthesize(dummyToken("be"), "VBD")));
    assertEquals("[presidents]", Arrays.toString(synth.synthesize(dummyToken("president"), "NNS")));
    assertEquals("[tested]", Arrays.toString(synth.synthesize(dummyToken("test"), "VBD")));
    assertEquals("[tested]", Arrays.toString(synth.synthesize(dummyToken("test"), "VBD", false)));
    //with regular expressions
    assertEquals("[tested]", Arrays.toString(synth.synthesize(dummyToken("test"), "VBD", true)));    
    assertEquals("[tested, testing]", Arrays.toString(synth.synthesize(dummyToken("test"), "VBD|VBG", true)));
    //with special indefinite article
    assertEquals("[a university, the university]", Arrays.toString(synth.synthesize(dummyToken("university"), "+DT", false)));
    assertEquals("[an hour, the hour]", Arrays.toString(synth.synthesize(dummyToken("hour"), "+DT", false)));
  }

}

@@ -1485,15 +1485,117 @@
 lse)));%0A
+    assertEquals(%22%5Ban hour%5D%22, Arrays.toString(synth.synthesize(dummyToken(%22hour%22), %22+INDT%22, false)));%0A
   %7D%0A%0A%7D%0A

add one more test