我有一个tapestry5 + hibernate 应用程序,我正在尝试为其编写单元测试。我正在寻找一些指导或最佳实践来测试此类项目中的 DAO 层。我使用 testng 尝试了下面的测试用例,但它没有用。
@Test
public void createOrderTest() {
IOCUtilities.buildDefaultRegistry();
OrderManager orderManager = new OrderManager();
Order o1 = new Order();
Date date = new Date(System.currentTimeMillis());
o1.setOrderDate(date);
o1.setOrderStatus(OrderStatus.BILLED.toString());
orderManager.createOrder(o1);
}
当我尝试运行测试用例时收到错误消息。
java.lang.IllegalArgumentException: Contribution org.apache.tapestry5.yuicompressor.services.YuiCompressorModule.contributeMinimizers(MappedConfiguration) (at YuiCompressorModule.java:42) is for service 'interface org.apache.tapestry5.services.assets.ResourceMinimizer' qualified with marker annotations [interface org.apache.tapestry5.ioc.annotations.Primary], which does not exist.
at org.apache.tapestry5.ioc.internal.RegistryImpl.validateContributeDefs(RegistryImpl.java:246)
at org.apache.tapestry5.ioc.internal.RegistryImpl.<init>(RegistryImpl.java:205)
at org.apache.tapestry5.ioc.RegistryBuilder.build(RegistryBuilder.java:177)
at org.apache.tapestry5.ioc.IOCUtilities.buildDefaultRegistry(IOCUtilities.java:51)
at com.vc.xpressor.testng.OrderManagerTest.createOrderTest(OrderManagerTest.java:21)