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
Expand Up @@ -2,6 +2,7 @@

public class Constants {

public static final String BUSINESS_UNIT_REF_DATA_URI = "/api/business-unit/ref-data/";
public static final String COURTS_REF_DATA_URI = "/api/court/ref-data/";
public static final String LJA_REF_DATA_URI = "/api/local-justice-area/ref-data/";
public static final String OFFENCES_REF_DATA_URI = "/api/offence/ref-data/";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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 filtering by business unit type {string}")
public void getRequestToBusinessUnitRefData(String filter) {

SerenityRest
.given()
.accept("*/*")
.header("Authorization", "Bearer " + getToken())
.contentType("application/json")
.when()
.get(getTestUrl() + BUSINESS_UNIT_REF_DATA_URI + filter);

}

@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,9 @@
@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 filtering by business unit type "area"
Then the business unit ref data matching to result