private void findTestedAndInjectableFields(@NotNull Field[] fieldsDeclaredInTestClass) { for (Field field : fieldsDeclaredInTestClass) { if (field.isAnnotationPresent(Injectable.class)) { MockedType mockedType = new MockedType(field); injectableFields.add(mockedType); } else { addAsTestedFieldIfApplicable(field); } } }
private void addAsTestedFieldIfApplicable(@NotNull Field fieldFromTestClass) { for (Annotation fieldAnnotation : fieldFromTestClass.getDeclaredAnnotations()) { Tested testedMetadata; if (fieldAnnotation instanceof Tested) { testedMetadata = (Tested) fieldAnnotation; } else { testedMetadata = fieldAnnotation.annotationType().getAnnotation(Tested.class); } if (testedMetadata != null) { TestedField testedField = new TestedField(injectionState, fieldFromTestClass, testedMetadata); testedFields.add(testedField); break; } } }