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

com.flextrade.jfixture.rules.FixtureRuleCustomisation Maven / Gradle / Ivy

Go to download

JFixture is an open source library based on the popular .NET library, AutoFixture

The newest version!
package com.flextrade.jfixture.rules;

import java.lang.reflect.Type;

import com.flextrade.jfixture.FluentCustomisation;
import com.flextrade.jfixture.JFixture;
import com.flextrade.jfixture.SpecimenSupplier;
import com.flextrade.jfixture.customisation.Customisation;
import com.flextrade.jfixture.customisation.fluent.AutoPropertyBehaviour;
import com.flextrade.jfixture.customisation.fluent.NoResolutionBehaviour;
import com.flextrade.jfixture.customisation.fluent.RecursionBehaviour;
import com.flextrade.jfixture.utility.Interceptor;

public class FixtureRuleCustomisation extends FixtureRule implements FluentCustomisation {

    private FluentCustomisation customisation;

    FixtureRuleCustomisation(JFixture fixture) {
        super(fixture);
        customisation = fixture.customise();
    }

    @Override
    public FixtureRuleCustomisation repeatCount(int count) {
        customisation.repeatCount(count);
        return this;
    }

    @Override
    public  FixtureRuleCustomisation sameInstance(Type type, T instance) {
        customisation.sameInstance(type, instance);
        return this;
    }

    @Override
    public  FixtureRuleCustomisation sameInstance(Class clazz, T instance) {
        customisation.sameInstance(clazz, instance);
        return this;
    }

    @Override
    public  FixtureRuleCustomisation lazyInstance(Type type, SpecimenSupplier supplier) {
        customisation.lazyInstance(type, supplier);
        return this;
    }

    @Override
    public  FixtureRuleCustomisation lazyInstance(Class clazz, SpecimenSupplier supplier) {
        customisation.lazyInstance(clazz, supplier);
        return this;
    }

    @Override
    public FluentCustomisation propertyOf(Class clazz, String name, Object value) {
        customisation.propertyOf(clazz, name, value);
        return this;
    }

    @Override
    public  FixtureRuleCustomisation useSubType(Class baseClass, Class subClass) {
        customisation.useSubType(baseClass, subClass);
        return this;
    }

    @Override
    public FixtureRuleCustomisation add(Customisation customisation) {
        this.customisation.add(customisation);
        return this;
    }

    @Override
    public  FixtureRuleCustomisation intercept(Class clazz, Interceptor interceptor) {
        customisation.intercept(clazz, interceptor);
        return this;
    }

    @Override
    public RecursionBehaviour circularDependencyBehaviour() {
        return customisation.circularDependencyBehaviour();
    }

    @Override
    public NoResolutionBehaviour noResolutionBehaviour() {
        return customisation.noResolutionBehaviour();
    }

    @Override
    public AutoPropertyBehaviour autoPropertyBehaviour() {
        return customisation.autoPropertyBehaviour();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy