Пример #1
0
  @Test
  public void testEJBInjectWiring() {
    String something = ejb3ServiceInterfaceWithInject.findSomething(12L);
    assertEquals("Something", something);

    String somethingDeep = ejb3ServiceInterfaceWithInject.findSomethingDeep(12L);
    assertEquals("Something Deep", somethingDeep);
  }
Пример #2
0
  @Test
  public void testEJBWiring() {
    String something = anInterface.findSomething(12L);
    assertEquals("Something", something);

    String somethingDeep = anInterface.findSomethingDeep(12L);
    assertEquals("Something Deep", somethingDeep);
  }
Пример #3
0
  @Test
  public void testModuleRegistration() {
    containerLifeCycleTestUtil.registerModule(new MockedInnerModule());

    EJB3ServiceInterface serviceInterface =
        containerLifeCycleTestUtil.getService(EJB3ServiceInterface.class);
    String something = serviceInterface.findSomethingDeep(12L);
    assertEquals("Mocked", something);
  }
Пример #4
0
  @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);
  }