@Override public void reifyTest(Set< FieldDescriptor> fieldDescriptors) { doPrivileged((PrivilegedAction<Object>) () -> { fieldDescriptors .parallelStream() .forEach(p -> { try { Field field = p.getField(); Type fieldType = p.getGenericType(); Set<? extends Annotation> fieldAnnotations = p.getAnnotations(); Optional<Real> real = p.getAnnotation(Real.class ); Object instance = locator.getService(fieldType, fieldAnnotations); if (instance == null) { return; } if (real.isPresent() && real.get().value()) { instance = mock(p.getType(), delegatesTo(instance)); } field.setAccessible(true); field.set(testInstance, instance); } catch (SecurityException | IllegalAccessException | IllegalArgumentException e) { throw new IllegalStateException(e); } }); return null; }); }
@Override public void reifyTest(Set< FieldDescriptor> fieldDescriptors) { doPrivileged((PrivilegedAction<Object>) () -> { fieldDescriptors .parallelStream() .forEach(p -> { try { Field field = p.getField(); Type fieldType = p.getGenericType(); Set<? extends Annotation> fieldAnnotations = p.getAnnotations(); Optional<Real> real = p.getAnnotation(Real.class ); Object instance = locator.getService(fieldType, fieldAnnotations); if (instance == null) { return; } if (real.isPresent() && real.get().value()) { instance = mock(p.getType(), delegatesTo(instance)); } field.setAccessible(true); field.set(testInstance, instance); } catch (SecurityException | IllegalAccessException | IllegalArgumentException e) { throw new IllegalStateException(e); } }); return null; }); }
@Override public void reifyTest(Set< FieldDescriptor> fieldDescriptors) { doPrivileged((PrivilegedAction<Object>) () -> { fieldDescriptors .parallelStream() .forEach(p -> { try { Field field = p.getField(); Type fieldType = p.getGenericType(); Set<? extends Annotation> fieldAnnotations = p.getAnnotations(); Optional<Real> real = p.getAnnotation(Real.class ); Object instance = locator.getService(fieldType, fieldAnnotations); if (instance == null) { return; } if (real.isPresent() && real.get().value()) { instance = mock(p.getType(), delegatesTo(instance)); } field.setAccessible(true); field.set(testInstance, instance); } catch (SecurityException | IllegalAccessException | IllegalArgumentException e) { throw new IllegalStateException(e); } }); return null; }); }
@Override public void reifyTest(Set< FieldDescriptor> fieldDescriptors) { doPrivileged((PrivilegedAction<Object>) () -> { fieldDescriptors .parallelStream() .forEach(p -> { try { Field field = p.getField(); Type fieldType = p.getGenericType(); Set<? extends Annotation> fieldAnnotations = p.getAnnotations(); Optional<Real> real = p.getAnnotation(Real.class ); Object instance = locator.getService(fieldType, fieldAnnotations); if (instance == null) { return; } if (real.isPresent() && real.get().value()) { instance = mock(p.getType(), delegatesTo(instance)); } field.setAccessible(true); field.set(testInstance, instance); } catch (SecurityException | IllegalAccessException | IllegalArgumentException e) { throw new IllegalStateException(e); } }); return null; }); }
if (real.isPresent() && real.get().value()) { instance = mock(field.getType(), delegatesTo(instance));
if (real.isPresent() && real.get().value()) { instance = mock(instance.getClass(), delegatesTo(instance));
if (real.isPresent() && real.get().value()) { instance = mock(instance.getClass(), delegatesTo(instance));
if (real.isPresent() && real.get().value()) { instance = mock(descriptor.getType(), delegatesTo(instance));
if (real != null && real.value()) { checkState(!isFinal(fieldType.getModifiers()), "Can not create delegated fake of field '%s' in test class '%s' "
if (real != null && real.value()) { checkState(!isFinal(fieldType.getModifiers()), "Can not create delegated fake of field '%s' in test class '%s' "