All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kubek2k.springockito.annotations.internal.definer.MockitoBeansDefiner Maven / Gradle / Ivy

There is a newer version: 1.0.9
Show newest version
package org.kubek2k.springockito.annotations.internal.definer;

import org.kubek2k.springockito.annotations.internal.factory.MockFactoryBean;
import org.mockito.Answers;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;

public class MockitoBeansDefiner {
    public AbstractBeanDefinition createMockFactoryBeanDefinition(Class mockClass, Class[] extraInterfaces, String mockName, Answers defaultAnswer) {
        AbstractBeanDefinition beanDefinition = BeanDefinitionBuilder.genericBeanDefinition(MockFactoryBean.class.getCanonicalName())
                .addConstructorArgValue(mockClass)
                .addConstructorArgValue(extraInterfaces)
                .addConstructorArgValue(mockName)
                .addConstructorArgValue(defaultAnswer)
                .getBeanDefinition();
        beanDefinition.setPrimary(true);
        return beanDefinition;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy