Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Po 313 bus units ref data #367

Merged
merged 9 commits into from
May 21, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package uk.gov.hmcts.opal.config;

public class Constants {

public static final String BUSINESS_UNIT_REF_DATA_URI = "/api/business-unit/ref-data/";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package uk.gov.hmcts.opal.steps;

import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import net.serenitybdd.rest.SerenityRest;
import org.hamcrest.Matchers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static net.serenitybdd.rest.SerenityRest.then;
import static uk.gov.hmcts.opal.config.Constants.BUSINESS_UNIT_REF_DATA_URI;
import static uk.gov.hmcts.opal.steps.BearerTokenStepDef.getToken;

public class BusinessUnitsStepDef extends BaseStepDef {

static Logger log = LoggerFactory.getLogger(BusinessUnitsStepDef.class.getName());

@When("I make a request to the business unit ref data api")
public void getRequestToBusinessUnitRefData() {
SerenityRest
.given()
.accept("*/*")
.header("Authorization", "Bearer " + getToken())
.contentType("application/json")
.when()
.get(getTestUrl() + BUSINESS_UNIT_REF_DATA_URI)
.then().log().all();

}

@Then("the business unit ref data matching to result")
public void theRefDataMatchingToResult() {
int totalCount = then().extract().jsonPath().getInt("count");
int refDataList = then().extract().jsonPath().getList("refData").size();
log.info("total count is : " + totalCount);
log.info("Total records in the json response" + refDataList);
then().assertThat()
.statusCode(200)
.body("count", Matchers.equalTo(refDataList));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

@Opal @PO-313
Feature: Verifying the end points for business units


Scenario: verifying the end points for API for Business Units Ref Data
Given I am testing as the "opal-test@hmcts.net" user
When I make a request to the business unit ref data api
Then the business unit ref data matching to result