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

Ref data Rest assured tests #357

Merged
merged 15 commits into from
May 20, 2024
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package uk.gov.hmcts.opal;

import org.junit.platform.suite.api.IncludeEngines;
import org.junit.platform.suite.api.IncludeTags;
import org.junit.platform.suite.api.SelectClasspathResource;
import org.junit.platform.suite.api.Suite;

@Suite
@IncludeEngines("cucumber")
@SelectClasspathResource("features")
@IncludeTags({"PO-311","PO-312", "PO-315"})
rajanigandra marked this conversation as resolved.
Show resolved Hide resolved
public class Junit5RunnerTest {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package uk.gov.hmcts.opal.config;

public class Constants {

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/";
}
21 changes: 21 additions & 0 deletions src/functionalTest/java/uk/gov/hmcts/opal/steps/Courts.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package uk.gov.hmcts.opal.steps;

import io.cucumber.java.en.When;
import net.serenitybdd.rest.SerenityRest;

import static uk.gov.hmcts.opal.config.Constants.COURTS_REF_DATA_URI;
import static uk.gov.hmcts.opal.steps.BearerTokenStepDef.getToken;

public class Courts extends BaseStepDef {

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

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package uk.gov.hmcts.opal.steps;

import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import net.serenitybdd.rest.SerenityRest;

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

public class LocalJusticeArea extends BaseStepDef{

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

}

@Then("the offence ref data response is {int}")
CadeFaulkner marked this conversation as resolved.
Show resolved Hide resolved
@Then("the court ref data response is {int}")
@Then("the LJA ref data response is {int}")
public void theOffenceRefDataResponseIs(int status) {
then().assertThat()
.statusCode(status);
}
}
18 changes: 18 additions & 0 deletions src/functionalTest/java/uk/gov/hmcts/opal/steps/Offences.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package uk.gov.hmcts.opal.steps;

import io.cucumber.java.en.When;
import net.serenitybdd.rest.SerenityRest;

import static uk.gov.hmcts.opal.config.Constants.OFFENCES_REF_DATA_URI;
import static uk.gov.hmcts.opal.steps.BearerTokenStepDef.getToken;

public class Offences extends BaseStepDef {

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

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Feature: Test the Offence Reference data for end points

@PO-311
CadeFaulkner marked this conversation as resolved.
Show resolved Hide resolved
#PO-311
Scenario: Checking the end points for Offence ref data
Given I am testing as the "opal-test@hmcts.net" user
When I make a request to the offence ref data api with
Then the offence ref data response is 200
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Feature: Test the Court data for end points

@PO-315
#PO-315
Scenario: Checking the end points for court ref data
Given I am testing as the "opal-test@hmcts.net" user
When I make a request to the court ref data api with
Then the court ref data response is 200
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Feature: Test the LJA Reference data for end points

@PO-312
#PO-312
Scenario: Checking the end points for LJA ref data
Given I am testing as the "opal-test@hmcts.net" user
When I make a request to the LJA ref data api with
Then the LJA ref data response is 200
Loading