/** * Loads the resource configuration for the given test object * * @return The resource configuration, if available. Null if not. */ public CFG loadResourceConfig(Object testObject) { return getResourceConfig(testObject.getClass()); }
if (annotation != null && isConfiguringAnnotation(annotation)) { configuringAnnotations.add(annotation); for (Field field : annotatedFields) { annotation = field.getAnnotation(annotationClass); if (isConfiguringAnnotation(annotation)) { configuringAnnotations.add(annotation); for (Method annotatedMethod : annotatedMethods) { annotation = annotatedMethod.getAnnotation(annotationClass); if (isConfiguringAnnotation(annotation)) { configuringAnnotations.add(annotation); if (isCustomConfigMethod(annotatedMethod)) { customConfigMethod = annotatedMethod; return null; return getResourceConfig(testClass.getSuperclass()); return createResourceConfig(configuringAnnotations.iterator().next(), customConfigMethod);
/** * @param testClass The test class, not null * @return The test class's custom configuration method, if any */ protected Method getCustomConfigMethod(Class<?> testClass) { Set<Method> annotatedMethods = AnnotationUtils.getMethodsAnnotatedWith(testClass, JpaEntityManagerFactory.class); for (Method annotatedMethod : annotatedMethods) { if (isCustomConfigMethod(annotatedMethod)) { return annotatedMethod; } } return null; }