Skip to content

Commit

Permalink
DMP-4613 Add ARM RPO check for getExtendedProductionsByMatter status
Browse files Browse the repository at this point in the history
Fixed sonar complaint
  • Loading branch information
karen-hedges committed Jan 22, 2025
1 parent 3e69b26 commit 84ee082
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,30 @@ void getIndexesByMatterIdWithEmptyIndexes() {
verifyNoMoreInteractions(armRpoService);
}

@Test
void getIndexesByMatterId_ThrowsException_WithMissingIndexDetails() {
IndexesByMatterIdResponse response = new IndexesByMatterIdResponse();
response.setStatus(200);
response.setIsError(false);

IndexesByMatterIdResponse.Index index = new IndexesByMatterIdResponse.Index();
response.setIndexes(List.of(index));

when(armRpoService.getArmRpoExecutionDetailEntity(anyInt())).thenReturn(armRpoExecutionDetailEntity);
when(armRpoClient.getIndexesByMatterId(anyString(), any(IndexesByMatterIdRequest.class))).thenReturn(response);

ArmRpoException armRpoException = assertThrows(ArmRpoException.class, () -> armRpoApi.getIndexesByMatterId("token", 1, "matterId", userAccount));

assertThat(armRpoException.getMessage(), containsString(
"Failure during ARM RPO get indexes by matter ID: Unable to find any indexes by matter ID in response"));
verify(armRpoService).updateArmRpoStateAndStatus(armRpoExecutionDetailEntityArgumentCaptor.capture(),
eq(ARM_RPO_HELPER_MOCKS.getGetIndexesByMatterIdRpoState()),
eq(ARM_RPO_HELPER_MOCKS.getInProgressRpoStatus()),
eq(userAccount));
verify(armRpoService).updateArmRpoStatus(eq(armRpoExecutionDetailEntity), eq(ARM_RPO_HELPER_MOCKS.getFailedRpoStatus()), eq(userAccount));
verifyNoMoreInteractions(armRpoService);
}

@AfterAll
static void close() {
ARM_RPO_HELPER_MOCKS.close();
Expand Down

0 comments on commit 84ee082

Please sign in to comment.