Ejemplo n.º 1
0
  @Test
  public void testEJBWiring() {
    String something = anInterface.findSomething(12L);
    assertEquals("Something", something);

    String somethingDeep = anInterface.findSomethingDeep(12L);
    assertEquals("Something Deep", somethingDeep);
  }
Ejemplo n.º 2
0
  @Test
  public void testEJBInjectWiring() {
    String something = ejb3ServiceInterfaceWithInject.findSomething(12L);
    assertEquals("Something", something);

    String somethingDeep = ejb3ServiceInterfaceWithInject.findSomethingDeep(12L);
    assertEquals("Something Deep", somethingDeep);
  }
Ejemplo n.º 3
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);
  }