@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); }
@Test public void testEJBEntityManagerInjectionCreate2() { SomeData someData = new SomeData(); someData.setName("The Name"); someData.setId(13L); someData = ejb3InnerServiceInterface.createSomethingForEntityManager(someData); assertEquals("The Name", someData.getName()); }
@Test public void testEJBEntityManagerInjection() { String something = ejb3InnerServiceInterface.findSomethingFromEntityManager(12L); assertEquals("The Name", something); }
@Test public void testEJBTypedResourceInjection() { String something = ejb3InnerServiceInterface.findSomethingFromDataSource2(12L); assertEquals("The Name", something); }