@Test public void testModuleRegistration() { containerLifeCycleTestUtil.registerModule(new MockedInnerModule()); EJB3ServiceInterface serviceInterface = containerLifeCycleTestUtil.getService(EJB3ServiceInterface.class); String something = serviceInterface.findSomethingDeep(12L); assertEquals("Mocked", something); }
@Test public void testEJBWiringWithMockito() { EJB3InnerServiceInterface anInterface = Mockito.mock(EJB3InnerServiceInterface.class); Mockito.when(anInterface.findSomething(12L)).thenReturn("Something Deep From Mock"); containerLifeCycleTestUtil.registerServiceInstance( EJB3InnerServiceInterface.class, anInterface); EJB3ServiceInterface serviceInterface = containerLifeCycleTestUtil.getService(EJB3ServiceInterface.class); String something = serviceInterface.findSomething(12L); assertEquals("Something", something); String somethingDeep = serviceInterface.findSomethingDeep(12L); assertEquals("Something Deep From Mock", somethingDeep); }