【发布时间】:2015-06-19 21:18:30
【问题描述】:
在 JUnit 测试中,我使用了 com.sun.xml.internal.ws.encoding.DataSourceStreamingDataHandler 类,这很糟糕,因为它是一个内部类,而且 Maven 拒绝编译我的 JUnit 测试,即使带有 -DskipTests 标志。
我的 JUnit 测试是:
@Test
public void test(){
ClassToTest tom = new ClassToTest();
URL url = this.getClass().getResource("/myXMLFile.xml");
File file = new File(url.getPath());
DataSource dataSource = new FileDataSource(file);
DataHandler dataHandler = new DataSourceStreamingDataHandler(dataSource);
MyJAXBObject list = tom.methodToTest(dataHandler);
for( JAXBTransazioneICT t : lista.getListaTransazioniICT() ){
LOG.debug(t.toString());
}
}
这门课有什么好的替代品吗?如果没有,我该如何编译我的 Maven 项目?
【问题讨论】:
-
你用这个类做什么?
-
@Tichodroma 我正在测试 MTOM Web 服务。我已经发布了我的 JUnit 案例。
-
所以您正在寻找
javax.activation.DataHandler的实现?模拟这个界面怎么样? -
@Tichodroma,是的,这是一个选项。但我认为找到可行的替代方案会更快。