org.mockito.internal.configuration.injection.SpyOnInjectedFieldsHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of securemock Show documentation
Show all versions of securemock Show documentation
Libraries for Elasticsearch
The newest version!
/*
* Copyright (c) 2007 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.internal.configuration.injection;
import org.mockito.Mockito;
import org.mockito.Spy;
import org.mockito.exceptions.base.MockitoException;
import org.mockito.internal.util.MockUtil;
import org.mockito.internal.util.reflection.FieldReader;
import java.lang.reflect.Field;
import java.util.Set;
import static org.mockito.Mockito.withSettings;
import static org.mockito.internal.util.reflection.FieldSetter.setField;
/**
* Handler for field annotated with @InjectMocks and @Spy.
*
*
* The handler assumes that field initialization AND injection already happened.
* So if the field is still null, then nothing will happen there.
*
*/
public class SpyOnInjectedFieldsHandler extends MockInjectionStrategy {
@Override
protected boolean processInjection(Field field, Object fieldOwner, Set © 2015 - 2025 Weber Informatics LLC | Privacy Policy