Skip to content

Commit

Permalink
Create KuromojiWrapperTest.java
Browse files Browse the repository at this point in the history
  • Loading branch information
pollseed committed Dec 10, 2015
1 parent b9b85cf commit 5d09e87
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/tmp/fxxk/kuromojiWrapper/KuromojiWrapperTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package kuromojiWrapper;

import java.util.LinkedList;
import java.util.Queue;

import junit.framework.Assert;

import org.junit.Test;

import com.atilika.kuromoji.jumandic.Token;

public class KuromojiWrapperTest {
static KuromojiWrapper KW = new KuromojiWrapper();

@Test
public void test_surfaces() {
final Queue<String> surfacesTrue = new LinkedList<String>() {
{
add("ほ");
add("げ");
add("ほ");
add("げ");
}
};
KW.surfaces("ほげほげ").forEach(v -> Assert.assertEquals(v, surfacesTrue.poll()));
}

@Test
public void test_features() {
final Queue<Token> tokens = new LinkedList<Token>();
KW.token("ほげほげ").forEach(v -> tokens.add(v));
KW.allFeatures("ほげほげ").forEach(v -> Assert.assertEquals(v, tokens.poll().getAllFeatures()));
}
}

0 comments on commit 5d09e87

Please sign in to comment.