Arquillian Google Guice Extension 1.0.0.Alpha2 发布了,主要是新特性是 Servlet 集成,可与 Guice Servlet 扩展进行集成。
示例代码:
@GuiceWebConfiguration @RunWith(Arquillian.class) public class WebInjectorTestCase { @Deployment public static Archive createTestArchive() { return ShrinkWrap.create(WebArchive.class, "guice-test.war") .addClasses(Employee.class, EmployeeService.class, DefaultEmployeeService.class, EmployeeRepository.class, DefaultEmployeeRepository.class, EmployeeModule.class, EmployeeModuleContextListener.class) .addAsWebInfResource("WEB-INF/web.xml", "web.xml"); } @Inject private EmployeeService employeeService; @Test public void testGetEmployees() { List result = employeeService.getEmployees(); assertNotNull("Method returned null list as result.", result); assertEquals("Two employees were expected.", 2, result.size()); } }
@GuiceWebConfiguration @RunWith(Arquillian.class) public class WebInjectorTestCase {
@Deployment public static Archive createTestArchive() { return ShrinkWrap.create(WebArchive.class, "guice-test.war") .addClasses(Employee.class, EmployeeService.class, DefaultEmployeeService.class, EmployeeRepository.class, DefaultEmployeeRepository.class, EmployeeModule.class, EmployeeModuleContextListener.class) .addAsWebInfResource("WEB-INF/web.xml", "web.xml"); }
@Inject private EmployeeService employeeService;
@Test public void testGetEmployees() {
List result = employeeService.getEmployees();
assertNotNull("Method returned null list as result.", result); assertEquals("Two employees were expected.", 2, result.size()); } }
Arquillian 可让你在远程或者嵌入式的容器里测试业务逻辑,同时可作为一个压缩包发布到容器中,并通过客户端来进行交互测试。
Arquillian 是一个可以方便的在现有类基础性扩展测试用例,基于 JUnit 。
评论删除后,数据将无法恢复
Arquillian Google Guice Extension 1.0.0.Alpha2
Arquillian Google Guice Extension 1.0.0.Alpha2 发布了,主要是新特性是 Servlet 集成,可与 Guice Servlet 扩展进行集成。
示例代码:
Arquillian 可让你在远程或者嵌入式的容器里测试业务逻辑,同时可作为一个压缩包发布到容器中,并通过客户端来进行交互测试。
Arquillian 是一个可以方便的在现有类基础性扩展测试用例,基于 JUnit 。