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

net.serenitybdd.core.steps.Instrumented Maven / Gradle / Ivy

There is a newer version: 4.2.1
Show newest version
package net.serenitybdd.core.steps;

import net.thucydides.core.steps.StepFactory;

public class Instrumented {

    private static StepFactory stepFactory = new StepFactory();

    public static  InstrumentedBuilder instanceOf(Class instanceClass) {
        return new InstrumentedBuilder(instanceClass);
    }


    public static class InstrumentedBuilder {

        private final Class instanceClass;

        private final Object[] constructorParameters;

        public InstrumentedBuilder(Class instanceClass) {
            this(instanceClass,  new Object[]{});
        }

        public InstrumentedBuilder(Class instanceClass, Object[] constructorParameters) {
            this.instanceClass = instanceClass;
            this.constructorParameters = constructorParameters;
        }

        public T newInstance() {
            return stepFactory.getUniqueStepLibraryFor(instanceClass, constructorParameters);
        }

        public T withProperties(Object... constructorParameters) {
            return new InstrumentedBuilder(instanceClass, constructorParameters).newInstance();
        }

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy