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

com.laamella.parameter_source.StubParameterSource Maven / Gradle / Ivy

There is a newer version: 1.0
Show newest version
package com.laamella.parameter_source;

import java.util.Optional;

/**
 * An object parameter source that returns the same object for all keys.
 * Suggested use is testing.
 */
public class StubParameterSource implements ParameterSource {
    private Object stubValue;

    public StubParameterSource(Object stubValue) {
        this.stubValue = stubValue;
    }

    @Override
    public Optional getOptionalObject(String key) {
        return Optional.ofNullable(stubValue);
    }

    public void setStubValue(Object stubValue) {
        this.stubValue = stubValue;
    }
}