测试Eclipse插件的启动配置委托

时间:2013-11-27 20:04:09

标签: java eclipse eclipse-plugin automated-tests

我想测试我的LaunchConfigurationDelegate,但是我无法模拟启动方法的eclipse类。我正在使用Mockito,当我运行测试时,我得到ILaunchConfiguration模拟的NoClassDefFoundError。测试看起来像这样

@Test
public void testLaunch() {
    ILaunchConfiguration config = mock(ILaunchConfiguration.class);
    ILaunch launch = mock(ILaunch.class);
    IProgressMonitor monitor = mock(IProgressMonitor.class);
    MyLaunchConfigurationDelegate launchDelegate = new MyLaunchConfigurationDelegate();

    try {
        launchDelegate.launch(config, "run", launch, monitor);
    } catch (CoreException e) {
        fail(e.getMessage());
    }
}

如何测试启动器?

0 个答案:

没有答案