private void injectInto ( final Object target , final boolean oneMatch ) throws AssertionError { boolean success = false ; for ( final Field field : this . collectFieldCandidates ( target ) ) { if ( this . isMatching ( field ) ) { Object val = getValue ( field ) ; try { field . setAccessible ( true ) ; this . inject ( target , field , val ) ; success = true ; } catch ( IllegalArgumentException | IllegalAccessException e ) { throw new AssertionError ( "Injection of " + val + " into " + target + " failed" , e ) ; } if ( oneMatch ) { return ; } } } assertTrue ( "No matching field for injection found" , success ) ; }
Injects the value of the Injection into the target .