Skip to content

Commit

Permalink
CCMSPUI-383 Modified endpoint to have required provider-id request pa…
Browse files Browse the repository at this point in the history
…ram and updated tests to reflect this

Signed-off-by: Jamie Briggs <jamie.briggs@digital.justice.gov.uk>
  • Loading branch information
JamieBriggs-MoJ committed Jan 14, 2025
1 parent e623156 commit 060799e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
6 changes: 3 additions & 3 deletions data-api/open-api-specification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -406,16 +406,16 @@ paths:
description: 'Not found'
'500':
description: 'Internal server error'
/{provider-firm-party-id}/cases:
/cases:
get:
tags:
- cases
summary: 'Get Cases'
operationId: 'getCases'
x-spring-paginated: true
parameters:
- name: 'provider-firm-party-id'
in: 'path'
- name: 'provider-id'
in: 'query'
required: true
schema:
type: 'integer'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,26 @@ void getCases_returnsData() throws Exception {
.thenReturn(Optional.of(caseDetails));
// Then
String jsonContent = objectMapper.writeValueAsString(caseDetails);
this.mockMvc.perform(get("/123/cases"))
this.mockMvc.perform(get("/cases?provider-id=123"))
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().json(jsonContent));
}

@Test
@DisplayName("getCases: Returns bad request")
void getCases_returnsBadRequest() throws Exception {
// Then
this.mockMvc.perform(get("/cases"))
.andDo(print())
.andExpect(status().isBadRequest());
}

@Test
@DisplayName("getCases: Returns not found")
void getCases_returnsNotFound() throws Exception {
// Then
this.mockMvc.perform(get("/123/cases"))
this.mockMvc.perform(get("/cases?provider-id=123"))
.andDo(print())
.andExpect(status().isNotFound());
}
Expand Down

0 comments on commit 060799e

Please sign in to comment.