generated from hmcts/spring-boot-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* removing docker-compose.yml file * removed unused imports * reformatted the files * reformatted the files to avoid violations * removed unused import * tidied up unused code * code has been changed slightly * using logged info and changed assertion * Fix checkstyle issues * applied filter to reduce the no.of records displaying on console --------- Co-authored-by: rajanigandra <Rajani Gandra> Co-authored-by: Cade Faulkner <147704481+CadeFaulkner@users.noreply.github.com> Co-authored-by: Sabah u din Irfan <sabah.irfan@gmail.com>
- Loading branch information
1 parent
73a7923
commit c321e25
Showing
8 changed files
with
124 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,5 @@ | |
@IncludeEngines("cucumber") | ||
@SelectClasspathResource("features") | ||
public class Junit5RunnerTest { | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
src/functionalTest/java/uk/gov/hmcts/opal/config/Constants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/"; | ||
} |
23 changes: 23 additions & 0 deletions
23
src/functionalTest/java/uk/gov/hmcts/opal/steps/Courts.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
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 getRequestToCourtsRefData() { | ||
SerenityRest | ||
.given() | ||
.accept("*/*") | ||
.header("Authorization", "Bearer " + getToken()) | ||
.contentType("application/json") | ||
.when() | ||
.get(getTestUrl() + COURTS_REF_DATA_URI); | ||
|
||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/functionalTest/java/uk/gov/hmcts/opal/steps/LocalJusticeArea.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
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.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 getRequestToLJARefData() { | ||
SerenityRest | ||
.given() | ||
.accept("*/*") | ||
.header("Authorization", "Bearer " + getToken()) | ||
.contentType("application/json") | ||
.when() | ||
.get(getTestUrl() + LJA_REF_DATA_URI); | ||
|
||
} | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
src/functionalTest/java/uk/gov/hmcts/opal/steps/Offences.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
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.OFFENCES_REF_DATA_URI; | ||
import static uk.gov.hmcts.opal.steps.BearerTokenStepDef.getToken; | ||
|
||
|
||
public class Offences extends BaseStepDef { | ||
|
||
static Logger log = LoggerFactory.getLogger(Offences.class.getName()); | ||
|
||
@When("I make a request to the offence ref data api filtering by cjs code {string}") | ||
public void getRequestToOffencesRefData(String filter) { | ||
SerenityRest | ||
.given() | ||
.accept("*/*") | ||
.header("Authorization", "Bearer " + getToken()) | ||
.contentType("application/json") | ||
.when() | ||
.get(getTestUrl() + OFFENCES_REF_DATA_URI + filter); | ||
|
||
} | ||
|
||
@Then("the LJA ref data matching to result") | ||
@Then("the court ref data matching to result") | ||
@Then("the offence 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)); | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
src/functionalTest/resources/features/opalMode/OffenceFeatures.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 @Opal | ||
#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 filtering by cjs code "AA06" | ||
Then the offence ref data matching to result |
8 changes: 8 additions & 0 deletions
8
src/functionalTest/resources/features/opalMode/courtsFeatures.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Feature: Test the Court data for end points | ||
|
||
@PO-315 @Opal | ||
#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 matching to result |
8 changes: 8 additions & 0 deletions
8
src/functionalTest/resources/features/opalMode/localJusticeAreaFeatures.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 @Opal | ||
#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 matching to result |