com.fitbur.mockito.internal.configuration.injection.SpyOnInjectedFieldsHandler Maven / Gradle / Ivy
/*
* Copyright (c) 2007 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package com.fitbur.mockito.internal.configuration.injection;
import com.fitbur.mockito.Mockito;
import com.fitbur.mockito.Spy;
import com.fitbur.mockito.exceptions.base.MockitoException;
import com.fitbur.mockito.internal.util.MockUtil;
import com.fitbur.mockito.internal.util.reflection.FieldReader;
import com.fitbur.mockito.internal.util.reflection.FieldSetter;
import java.lang.reflect.Field;
import java.util.Set;
import static com.fitbur.mockito.Mockito.withSettings;
import static com.fitbur.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 - 2024 Weber Informatics LLC | Privacy Policy