Class InjectMocksScanner


  • public class InjectMocksScanner
    extends java.lang.Object
    Scan field for injection.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Class<?> clazz  
    • Constructor Summary

      Constructors 
      Constructor Description
      InjectMocksScanner​(java.lang.Class<?> clazz)
      Create a new InjectMocksScanner for the given clazz on the given instance
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addTo​(java.util.Set<java.lang.reflect.Field> mockDependentFields)
      Add the fields annotated by @InjectMocks
      private static void assertNoAnnotations​(java.lang.reflect.Field field, java.lang.Class<? extends java.lang.annotation.Annotation>... annotations)  
      private java.util.Set<java.lang.reflect.Field> scan()
      Scan fields annotated by @InjectMocks
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • clazz

        private final java.lang.Class<?> clazz
    • Constructor Detail

      • InjectMocksScanner

        public InjectMocksScanner​(java.lang.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 Detail

      • addTo

        public void addTo​(java.util.Set<java.lang.reflect.Field> mockDependentFields)
        Add the fields annotated by @InjectMocks
        Parameters:
        mockDependentFields - Set of fields annotated by @InjectMocks
      • scan

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

        private static void assertNoAnnotations​(java.lang.reflect.Field field,
                                                java.lang.Class<? extends java.lang.annotation.Annotation>... annotations)