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

io.github.olib963.javatest.fixtures.internal.FunctionFixtureDefinition Maven / Gradle / Ivy

package io.github.olib963.javatest.fixtures.internal;

import io.github.olib963.javatest.fixtures.FixtureDefinition;
import io.github.olib963.javatest.fixtures.Try;

import java.util.function.Function;
import java.util.function.Supplier;

public class FunctionFixtureDefinition implements FixtureDefinition {
    private final Supplier> creator;
    private final Function> destroyer;

    public FunctionFixtureDefinition(Supplier> creator, Function> destroyer) {
        this.creator = creator;
        this.destroyer = destroyer;
    }

    @Override
    public Try create() {
        return creator.get();
    }

    @Override
    public Try destroy(FixtureType fixture) {
        return destroyer.apply(fixture);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy