com.fitbur.mockito.internal.configuration.injection.MockInjection 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 java.lang.reflect.Field;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import static com.fitbur.mockito.internal.util.Checks.checkItemsNotNull;
import static com.fitbur.mockito.internal.util.Checks.checkNotNull;
import static com.fitbur.mockito.internal.util.collections.Sets.newMockSafeHashSet;
/**
* Internal injection configuration utility.
*
*
* Allow the user of this class to configure the way the injection of mocks will happen.
*
*
*/
public class MockInjection {
/**
* Create a new configuration setup for a field
*
*
* @param field Field needing mock injection
* @param ofInstance Instance owning the field
* @return New configuration builder
*/
public static OngoingMockInjection onField(Field field, Object ofInstance) {
return new OngoingMockInjection(field, ofInstance);
}
/**
* Create a new configuration setup for fields
*
*
* @param fields Fields needing mock injection
* @param ofInstance Instance owning the field
* @return New configuration builder
*/
public static OngoingMockInjection onFields(Set fields, Object ofInstance) {
return new OngoingMockInjection(fields, ofInstance);
}
/**
* Ongoing configuration of the mock injector.
*/
public static class OngoingMockInjection {
private final Set fields = new HashSet();
private final Set
© 2015 - 2024 Weber Informatics LLC | Privacy Policy