CdiResolver implements IDataServiceResolver { @Override public Scope getScope(Class clazz) { for (Annotation anno : clazz.getAnnotations()) { String annoName = anno.annotationType().getName(); switch (annoName) { case "javax.enterprise.context.Dependent": return Scope.SESSION; case "javax.ejb.Stateful": return Scope.SESSION; default: } } return Scope.MANAGED; }  @Override T resolveDataService(Class<T> clazz); @Override Scope getScope(Class clazz);  }
@Test public void testGetScopeSession() { System.out.println("getScopeSession"); Scope expResult = Scope.SESSION; Scope result = cdiResolver.getScope(CDIBeanSession.class); assertThat(result).isEqualTo(expResult); }
@Test public void testGetScopeSession2() { System.out.println("getScopeSession"); Scope expResult = Scope.SESSION; Scope result = cdiResolver.getScope(EJBBeanSession.class); assertThat(result).isEqualTo(expResult); }
@Test public void testGetScopeManaged() { System.out.println("getScopeManaged"); Scope expResult = Scope.MANAGED; Scope result = cdiResolver.getScope(CDIBeanManaged.class); assertThat(result).isEqualTo(expResult); result = cdiResolver.getScope(EJBBeanManaged.class); assertThat(result).isEqualTo(expResult); }