@Test(expected = InjectionException.class) public void testMissingAnnotation() { final Map<String, EntityManagerFactory> factories = createFactories("foo", "bar"); final PersistenceContextAnnotationProcessor p = new PersistenceContextAnnotationProcessor(factories); p.getPersistenceContextAnnotation(new Annotation[0]); }
PersistenceContext getPersistenceContextAnnotation(final Annotation[] annotations) { for (final Annotation annotation : annotations) { if (annotation.annotationType() == PersistenceContext.class) { return (PersistenceContext) annotation; } } throw new InjectionException("Missing @PersistenceContext annotation"); }
PersistenceContextAnnotationProcessor implements FieldAnnotationProcessor<EntityManager> { PersistenceContext getPersistenceContextAnnotation(final Annotation[] annotations) { for (final Annotation annotation : annotations) { if (annotation.annotationType() == PersistenceContext.class) { return (PersistenceContext) annotation; } } throw new InjectionException("Missing @PersistenceContext annotation"); } }
PersistenceContextAnnotationProcessor implements FieldAnnotationProcessor<EntityManager> { PersistenceContext getPersistenceContextAnnotation(final Annotation[] annotations) { for (final Annotation annotation : annotations) { if (annotation.annotationType() == PersistenceContext.class) { return (PersistenceContext) annotation; } } throw new InjectionException("Missing @PersistenceContext annotation"); } PersistenceContextAnnotationProcessor(final Map<String, EntityManagerFactory> factories); }
PersistenceContextAnnotationProcessor implements FieldAnnotationProcessor<EntityManager> { PersistenceContext getPersistenceContextAnnotation(final Annotation[] annotations) { for (final Annotation annotation : annotations) { if (annotation.annotationType() == PersistenceContext.class) { return (PersistenceContext) annotation; } } throw new InjectionException("Missing @PersistenceContext annotation"); } PersistenceContextAnnotationProcessor(final Map<String, EntityManagerFactory> factories); @Override @SuppressWarnings("unchecked") MinijaxProvider<EntityManager> buildProvider(
            final MinijaxInjectorState state,
            final Class<EntityManager> type,
            final Annotation[] annotations); }
PersistenceContextAnnotationProcessor implements FieldAnnotationProcessor<EntityManager> { PersistenceContext getPersistenceContextAnnotation(final Annotation[] annotations) { for (final Annotation annotation : annotations) { if (annotation.annotationType() == PersistenceContext.class) { return (PersistenceContext) annotation; } } throw new InjectionException("Missing @PersistenceContext annotation"); } PersistenceContextAnnotationProcessor(final Map<String, EntityManagerFactory> factories); @Override @SuppressWarnings("unchecked") MinijaxProvider<EntityManager> buildProvider(
            final MinijaxInjectorState state,
            final Class<EntityManager> type,
            final Annotation[] annotations);  }