⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wordreadertest.java

📁 使用OSGi框架开发的分布式电子辞典
💻 JAVA
字号:
/*
 * @(#)WordReaderTest.java
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program 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 Library General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
package cn.edu.ynu.sei.dict.plugin.dictmanager;

import cn.edu.ynu.sei.dict.core.service.Word;
import cn.edu.ynu.sei.dict.core.exception.NotFoundWordException;
import cn.edu.ynu.sei.dict.plugin.db.connector.service.IDatabaseConnector;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 * Test case of class <code>WordReader</code>.
 * @author zy
 * @author 88250
 * @version 1.1.0.0, Mar 12, 2008
 * @see cn.edu.ynu.sei.dict.plugin.db.WordReader
 */
public class WordReaderTest {

    private IDatabaseConnector dbConnector;

    private WordReader instance = new WordReader(dbConnector);

    /**
     * Test of lookup method, of class WordReader.
     */
    @Test
    public void lookup() {
        System.out.println("lookup");
        Word word = new Word();
        word.self = "d";
        Word result;
        try {
            result = instance.lookup(word);
            System.out.println(result.self + ": " + result.definition);
        } catch (NotFoundWordException ex) {
            Logger.getLogger(WordReaderTest.class.getName()).log(Level.SEVERE,
                                                                 null, ex);
        }

    }

    /**
     * Test of lookupSimilarList method, of class WordReader.
     */
    // @Test
    public void lookupSimilarList() {
        System.out.println("lookupSimilarList");
        try {
            String result = instance.lookupSimilarList("beyo");
            System.out.println(result);
        } catch (NotFoundWordException ex) {
            Logger.getLogger(WordReaderTest.class.getName()).log(Level.SEVERE,
                                                                 null, ex);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -