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.
PO-349: Add Major Creditor reference data endpoint & associated code (#…
…363) * Add Major Creditor reference data endpoint & associated code * Test added for major creditor ref data and file names changed for courts and offences * assertions added for ref data * removed logging * removed logging * removed logging --------- Co-authored-by: rajanigandra <Rajani Gandra>
- Loading branch information
1 parent
cda907f
commit 6b1704f
Showing
15 changed files
with
302 additions
and
15 deletions.
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
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
43 changes: 43 additions & 0 deletions
43
src/functionalTest/java/uk/gov/hmcts/opal/steps/MajorCreditorsStepDef.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,43 @@ | ||
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.apache.http.HttpStatus; | ||
|
||
|
||
|
||
import static net.serenitybdd.rest.SerenityRest.then; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static uk.gov.hmcts.opal.config.Constants.MAJOR_CREDITORS_URI; | ||
|
||
import static uk.gov.hmcts.opal.steps.BearerTokenStepDef.getToken; | ||
|
||
public class MajorCreditorsStepDef extends BaseStepDef { | ||
|
||
|
||
@When("I make a request to the major creditors ref data api filter by major creditor id {int}") | ||
public void getRequestToMajorCreditorsBy(int majorCreditorId) { | ||
|
||
SerenityRest | ||
.given() | ||
.accept("*/*") | ||
.header("Authorization", "Bearer " + getToken()) | ||
.contentType("application/json") | ||
.when() | ||
.get(getTestUrl() + MAJOR_CREDITORS_URI + majorCreditorId); | ||
|
||
} | ||
|
||
@Then("the major creditors ref data matching to result") | ||
public void theMajorCreditorsRefDataMatchingToResult() { | ||
then().assertThat() | ||
.statusCode(HttpStatus.SC_OK) | ||
.body("name",equalTo("CHESTERFIELD BOROUGH COUNCIL")) | ||
.body("majorCreditorId",equalTo(15)); | ||
|
||
|
||
|
||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
src/functionalTest/resources/features/opalMode/majorCreditorFeatures.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,7 @@ | ||
Feature: Verifying the end points for the Major Creditors | ||
|
||
@PO-349 @Opal | ||
Scenario: Verifying the end points for the major creditors | ||
Given I am testing as the "opal-test@hmcts.net" user | ||
When I make a request to the major creditors ref data api filter by major creditor id 15 | ||
Then the major creditors ref data matching to result |
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
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
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
32 changes: 32 additions & 0 deletions
32
src/main/java/uk/gov/hmcts/opal/dto/reference/MajorCreditorReferenceDataResults.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,32 @@ | ||
package uk.gov.hmcts.opal.dto.reference; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import uk.gov.hmcts.opal.entity.projection.MajorCreditorReferenceData; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@Builder | ||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class MajorCreditorReferenceDataResults { | ||
private Integer count; | ||
private List<MajorCreditorReferenceData> refData; | ||
|
||
public static class MajorCreditorReferenceDataResultsBuilder { | ||
public MajorCreditorReferenceDataResults.MajorCreditorReferenceDataResultsBuilder refData( | ||
List<MajorCreditorReferenceData> refData) { | ||
this.refData = refData; | ||
return this.count(Optional.ofNullable(refData).map(List::size).orElse(0)); | ||
} | ||
|
||
private MajorCreditorReferenceDataResults.MajorCreditorReferenceDataResultsBuilder count(Integer count) { | ||
this.count = count; | ||
return this; | ||
} | ||
} | ||
} |
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
5 changes: 5 additions & 0 deletions
5
src/main/java/uk/gov/hmcts/opal/entity/projection/MajorCreditorReferenceData.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,5 @@ | ||
package uk.gov.hmcts.opal.entity.projection; | ||
|
||
public record MajorCreditorReferenceData(Long majorCreditorId, String majorCreditorCode, String name, String postcode) { | ||
|
||
} |
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
Oops, something went wrong.