org.mockito.internal.configuration.injection.ConstructorInjection 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.exceptions.base.MockitoException;
import org.mockito.internal.util.reflection.FieldInitializationReport;
import org.mockito.internal.util.reflection.FieldInitializer;
import org.mockito.internal.util.reflection.FieldInitializer.ConstructorArgumentResolver;
import static org.mockito.internal.exceptions.Reporter.fieldInitialisationThrewException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* Injection strategy based on constructor.
*
*
* The strategy will search for the constructor with most parameters
* and try to resolve mocks by type.
*
*
*
* TODO on missing mock type, shall it abandon or create "noname" mocks.
* TODO and what if the arg type is not mockable.
*
*
*
* For now the algorithm tries to create anonymous mocks if an argument type is missing.
* If not possible the algorithm abandon resolution.
*
*/
public class ConstructorInjection extends MockInjectionStrategy {
public ConstructorInjection() { }
public boolean processInjection(Field field, Object fieldOwner, Set © 2015 - 2025 Weber Informatics LLC | Privacy Policy