我有一个tapestry5 + hibernate应用程序,我正在尝试编写单元测试。我正在寻找一些指导或最佳实践来测试这些项目中的DAO层。 我使用testng在测试用例下面试过,但没有奏效。如何测试挂钩依赖项目中的DAO层
@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)
Thanks @uklance this helps。 – srinik 2013-03-28 15:00:49