Skip to content

Commit 399992e

Browse files
committed
DMP-5252-ARM-5-2-Upgrade
Added tests
1 parent c02c51e commit 399992e

File tree

3 files changed

+49
-6
lines changed

3 files changed

+49
-6
lines changed

src/integrationTest/java/uk/gov/hmcts/darts/arm/client/version/fivetwo/ArmApiBaseClientIntTest.java

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ void armApiBaseClient_Returns200Success_ShouldSucceed(String suffix,
208208
}
209209

210210
@Test
211-
void downloadProduction_serverReturns200Success_ShouldSucceed() throws IOException {
211+
void downloadProduction_Returns200Success_ShouldSucceed() throws IOException {
212212
String url = "downloadProduction/1234/false";
213213
String suffix = "downloadProduction";
214214
stubFor(
@@ -232,7 +232,7 @@ void downloadProduction_serverReturns200Success_ShouldSucceed() throws IOExcepti
232232
}
233233

234234
@Test
235-
void getRecordManagementMatter_ShouldSucceedIfServerReturns200Success_WithEmptyRequest() throws Exception {
235+
void getRecordManagementMatter_ShouldSucceed_IfServerReturns200Success_WithEmptyRequest() throws Exception {
236236
// Given
237237
var bearerAuth = "Bearer some-token";
238238
EmptyRpoRequest request = EmptyRpoRequest.builder().build();
@@ -256,6 +256,49 @@ void getRecordManagementMatter_ShouldSucceedIfServerReturns200Success_WithEmptyR
256256
);
257257
}
258258

259+
@Test
260+
void createExportBasedOnSearchResultsTable_ShouldSucceed_WithFullRequest() throws Exception {
261+
// Given
262+
var bearerAuth = "Bearer some-token";
263+
CreateExportBasedOnSearchResultsTableRequest request = CreateExportBasedOnSearchResultsTableRequest.builder()
264+
.core("some-core")
265+
.formFields("some-form-fields")
266+
.searchId("some-search-id")
267+
.searchitemsCount(1)
268+
.headerColumns(
269+
List.of(CreateExportBasedOnSearchResultsTableRequest.HeaderColumn.builder()
270+
.masterIndexField("some-master-index-field")
271+
.displayName("some-display-name")
272+
.propertyName("some-property-name")
273+
.propertyType("some-property-type")
274+
.isMasked(true)
275+
.build())
276+
)
277+
.productionName("some-production-name")
278+
.storageAccountId("some-storage-account-id")
279+
.onlyForCurrentUser(Boolean.FALSE)
280+
.exportType(32)
281+
.build();
282+
283+
stubFor(
284+
WireMock.post(urlEqualTo("/v1/CreateExportBasedOnSearchResultsTable"))
285+
.willReturn(
286+
aResponse()
287+
.withHeader("Content-type", "application/json")
288+
.withBody(TestUtils.getContentsFromFile(MOCK_RESPONSE_DIRECTORY + "CreateExportBasedOnSearchResultsTable.json"))
289+
.withStatus(200)));
290+
291+
// When
292+
armApiBaseClient.createExportBasedOnSearchResultsTable(bearerAuth, request);
293+
294+
// Then
295+
verify(postRequestedFor(urlEqualTo("/v1/CreateExportBasedOnSearchResultsTable"))
296+
.withHeader(AUTHORIZATION, equalTo(bearerAuth))
297+
.withRequestBody(matchingJsonPath("$.productionName", equalTo("some-production-name")))
298+
.withHeader(CONTENT_TYPE, equalTo(APPLICATION_JSON_VALUE))
299+
);
300+
}
301+
259302
@Test
260303
void updateMetadata_ShouldSucceed_WhenServerReturns200Success() {
261304
// Given

src/integrationTest/java/uk/gov/hmcts/darts/arm/client/version/fivetwo/ArmAuthClientIntTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ArmAuthClientIntTest extends IntegrationBaseWithWiremock {
2727
private static final String TOKEN_PATH = "/account/token";
2828

2929
@Test
30-
void getTokenShouldSucceedIfServerReturns200Success() {
30+
void getToken_ShouldSucceed_IfServerReturns200Success() {
3131
// Given
3232
stubFor(
3333
WireMock.post(urlEqualTo(TOKEN_PATH))
@@ -61,7 +61,7 @@ void getTokenShouldSucceedIfServerReturns200Success() {
6161

6262
@Test
6363
@SuppressWarnings("PMD.DoNotUseThreads")
64-
void getTokenShouldThrowExceptionIfServerReturns403Forbidden() throws InterruptedException {
64+
void getToken_ShouldThrowException_IfServerReturns403Forbidden() throws InterruptedException {
6565
// Given
6666
stubFor(
6767
WireMock.post(urlEqualTo(TOKEN_PATH))

src/main/java/uk/gov/hmcts/darts/arm/client/version/fivetwo/ArmApiBaseClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,15 @@ ExtendedSearchesByMatterResponse getExtendedSearchesByMatter(@RequestHeader(AUTH
119119
ProductionOutputFilesResponse getProductionOutputFiles(@RequestHeader(AUTHORIZATION) String bearerToken,
120120
@RequestBody ProductionOutputFilesRequest productionOutputFilesRequest);
121121

122-
@PostMapping(value = "${darts.storage.arm-api.version5-2.api.rpo-url.create-export-based-on-search-results-table-path}",
122+
@PostMapping(value = "${darts.storage.arm-api.version5-2.api.create-export-based-on-search-results-table-path}",
123123
consumes = APPLICATION_JSON_VALUE,
124124
produces = APPLICATION_JSON_VALUE
125125
)
126126
CreateExportBasedOnSearchResultsTableResponse createExportBasedOnSearchResultsTable(
127127
@RequestHeader(AUTHORIZATION) String bearerToken, @RequestBody CreateExportBasedOnSearchResultsTableRequest request);
128128

129129

130-
@PostMapping(value = "${darts.storage.arm-api.version5-2.api.rpo-url.remove-production-path}",
130+
@PostMapping(value = "${darts.storage.arm-api.version5-2.api.remove-production-path}",
131131
consumes = APPLICATION_JSON_VALUE,
132132
produces = APPLICATION_JSON_VALUE
133133
)

0 commit comments

Comments
 (0)