/* 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;

import junit.framework.TestCase;

public class AnalyzedTokenTest extends TestCase {

  public void testToString() {
    AnalyzedToken testToken = new AnalyzedToken("word", "POS", "lemma");
    assertEquals("lemma/POS", testToken.toString());
    assertEquals("lemma", testToken.getLemma());
    testToken = new AnalyzedToken("word", "POS", null);
    assertEquals("word/POS", testToken.toString());
    assertEquals(null, testToken.getLemma());
    assertEquals("word", testToken.getToken());
  }
  
  public void testMatches() {
    AnalyzedToken testToken1 = new AnalyzedToken("word", "POS", "lemma");    
    AnalyzedToken testToken2 = new AnalyzedToken("", null, null);
    assertFalse(testToken1.matches(testToken2));
    testToken2 = new AnalyzedToken("word", null, null);
    assertTrue(testToken1.matches(testToken2));
    testToken2 = new AnalyzedToken("word", "POS", null);
    assertTrue(testToken1.matches(testToken2));
    testToken2 = new AnalyzedToken("word", "POS", "lemma");
    assertTrue(testToken1.matches(testToken2));
    testToken2 = new AnalyzedToken("word", "POS1", "lemma");
    assertFalse(testToken1.matches(testToken2));
    testToken2 = new AnalyzedToken("word1", "POS", "lemma");
    assertFalse(testToken1.matches(testToken2));
    testToken2 = new AnalyzedToken("word", "POS", "lemma1");
    assertFalse(testToken1.matches(testToken2));
    testToken2 = new AnalyzedToken("", "POS", "lemma");
    assertTrue(testToken1.matches(testToken2));    
    testToken2 = new AnalyzedToken("", null, "lemma");
    assertTrue(testToken1.matches(testToken2));
  }
  
}

@@ -994,32 +994,38 @@
 oString() %7B%0A    
+final 
 AnalyzedToken te
@@ -1175,32 +1175,52 @@
 etLemma());%0A    
+final AnalyzedToken 
 testToken = new 
@@ -1204,32 +1204,33 @@
 dToken testToken
+2
  = new AnalyzedT
@@ -1286,32 +1286,33 @@
 /POS%22, testToken
+2
 .toString());%0A  
@@ -1333,32 +1333,33 @@
 (null, testToken
+2
 .getLemma());%0A  
@@ -1386,24 +1386,25 @@
 %22, testToken
+2
 .getToken())
@@ -1442,24 +1442,30 @@
 hes() %7B%0A    
+final 
 AnalyzedToke
@@ -1534,35 +1534,39 @@
     
-AnalyzedToken testToken2 = 
+assertFalse(testToken1.matches(
 new 
@@ -1586,32 +1586,34 @@
 (%22%22, null, null)
+))
 ;%0A    assertFals
@@ -1600,36 +1600,35 @@
 l)));%0A    assert
-Fals
+Tru
 e(testToken1.mat
@@ -1636,39 +1636,8 @@
 hes(
-testToken2));%0A    testToken2 = 
 new 
@@ -1665,24 +1665,26 @@
  null, null)
+))
 ;%0A    assert
@@ -1711,39 +1711,8 @@
 hes(
-testToken2));%0A    testToken2 = 
 new 
@@ -1737,32 +1737,34 @@
 d%22, %22POS%22, null)
+))
 ;%0A    assertTrue
@@ -1787,39 +1787,8 @@
 hes(
-testToken2));%0A    testToken2 = 
 new 
@@ -1816,32 +1816,34 @@
  %22POS%22, %22lemma%22)
+))
 ;%0A    assertTrue
@@ -1830,35 +1830,36 @@
 %22)));%0A    assert
-Tru
+Fals
 e(testToken1.mat
@@ -1867,39 +1867,8 @@
 hes(
-testToken2));%0A    testToken2 = 
 new 
@@ -1897,32 +1897,34 @@
 %22POS1%22, %22lemma%22)
+))
 ;%0A    assertFals
@@ -1948,39 +1948,8 @@
 hes(
-testToken2));%0A    testToken2 = 
 new 
@@ -1978,32 +1978,34 @@
  %22POS%22, %22lemma%22)
+))
 ;%0A    assertFals
@@ -2029,39 +2029,8 @@
 hes(
-testToken2));%0A    testToken2 = 
 new 
@@ -2067,16 +2067,18 @@
 lemma1%22)
+))
 ;%0A    as
@@ -2073,36 +2073,35 @@
 %22)));%0A    assert
-Fals
+Tru
 e(testToken1.mat
@@ -2109,39 +2109,8 @@
 hes(
-testToken2));%0A    testToken2 = 
 new 
@@ -2134,33 +2134,39 @@
  %22POS%22, %22lemma%22)
-;
+));    
 %0A    assertTrue(
@@ -2188,43 +2188,8 @@
 hes(
-testToken2));    %0A    testToken2 = 
 new 
@@ -2224,54 +2224,8 @@
 ma%22)
-;%0A    assertTrue(testToken1.matches(testToken2
 ));%0A

simplify test code