| 1 |
package morfologik.stemming; |
| 2 |
|
| 3 |
import java.io.IOException; |
| 4 |
import java.io.InputStream; |
| 5 |
import java.nio.file.Files; |
| 6 |
import java.nio.file.Path; |
| 7 |
|
| 8 |
import org.junit.Test; |
| 9 |
|
| 10 |
import com.carrotsearch.randomizedtesting.RandomizedTest; |
| 11 |
import static org.junit.Assert.*; |
| 12 |
|
| 13 |
public class DictionaryTest extends RandomizedTest { |
| 14 |
@Test |
| 15 |
public void testReadFromFile() throws IOException { |
| 16 |
Path tempDir = super.newTempDir(); |
| 17 |
|
| 18 |
Path dict = tempDir.resolve("odd name.dict"); |
| 19 |
Path info = dict.resolveSibling("odd name.info"); |
| 20 |
try (InputStream dictInput = this.getClass().getResource("test-infix.dict").openStream(); |
| 21 |
InputStream infoInput = this.getClass().getResource("test-infix.info").openStream()) { |
| 22 |
Files.copy(dictInput, dict); |
| 23 |
Files.copy(infoInput, info); |
| 24 |
} |
| 25 |
|
| 26 |
assertNotNull(Dictionary.read(dict.toUri().toURL())); |
| 27 |
assertNotNull(Dictionary.read(dict)); |
| 28 |
} |
| 29 |
} |