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

io.mstream.trader.commons.test.cucumber.MonitoringStepDefs Maven / Gradle / Ivy

There is a newer version: 1.14
Show newest version
package io.mstream.trader.commons.test.cucumber;

import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import io.mstream.trader.commons.config.Application;
import io.mstream.trader.commons.config.model.Version;
import io.mstream.trader.commons.test.TestContext;

import javax.inject.Inject;

import static io.restassured.RestAssured.when;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;


public class MonitoringStepDefs {

    private static final String VERSION_PATH =
            "/monitoring/version";

    private final TestContext testContext;
    private final Version version;

    @Inject
    public MonitoringStepDefs(
            TestContext testContext,
            @Application Version version
    ) {
        this.testContext = testContext;
        this.version = version;
    }

    @When("^I request the service version$")
    public void i_request_the_service_version() throws Throwable {
        testContext.setServiceResponse(when().get(VERSION_PATH).then());

    }

    @Then("^version should have a proper value$")
    public void version_should_have_a_proper_value() throws Throwable {
        testContext.getServiceResponse().body("value", is(equalTo(version.getValue())));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy