Class InjectMocksScanner

java.lang.Object
org.mockito.internal.configuration.injection.scanner.InjectMocksScanner

public class InjectMocksScanner extends Object
Scan field for injection.
  • Field Details

    • clazz

      private final Class<?> clazz
  • Constructor Details

    • InjectMocksScanner

      public InjectMocksScanner(Class<?> clazz)
      Create a new InjectMocksScanner for the given clazz on the given instance
      Parameters:
      clazz - Current class in the hierarchy of the test
  • Method Details

    • addTo

      public void addTo(Set<Field> mockDependentFields)
      Add the fields annotated by @InjectMocks
      Parameters:
      mockDependentFields - Set of fields annotated by @InjectMocks
    • scan

      private Set<Field> scan()
      Scan fields annotated by @InjectMocks
      Returns:
      Fields that depends on Mock
    • assertNoAnnotations

      private static void assertNoAnnotations(Field field, Class<? extends Annotation>... annotations)