com.fitbur.mockito.internal.configuration.injection.scanner.MockScanner 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.scanner;
import com.fitbur.mockito.Mock;
import com.fitbur.mockito.Spy;
import com.fitbur.mockito.internal.util.MockUtil;
import com.fitbur.mockito.internal.util.reflection.FieldReader;
import java.lang.reflect.Field;
import java.util.Set;
import static com.fitbur.mockito.internal.util.collections.Sets.newMockSafeHashSet;
/**
* Scan mocks, and prepare them if needed.
*/
public class MockScanner {
private final MockUtil mockUtil = new MockUtil();
private final Object instance;
private final Class> clazz;
/**
* Creates a MockScanner.
*
* @param instance The test instance
* @param clazz The class in the type hierarchy of this instance.
*/
public MockScanner(Object instance, Class> clazz) {
this.instance = instance;
this.clazz = clazz;
}
/**
* Add the scanned and prepared mock instance to the given collection.
*
*
* The preparation of mocks consists only in defining a MockName if not already set.
*
*
* @param mocks Set of mocks
*/
public void addPreparedMocks(Set
© 2015 - 2024 Weber Informatics LLC | Privacy Policy