Skip to content

Commit

Permalink
Add test for failed claim in case user ID changes
Browse files Browse the repository at this point in the history
  • Loading branch information
romanstrobl committed Nov 18, 2024
1 parent 542a19f commit 1cf7657
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,25 @@ void testOperationClaim() throws Exception {
assertEquals(userId, operationService.operationClaim(claimRequest).getUserId());
}

@Test
void testOperationClaimFailDifferentUserId() throws Exception {
final OperationCreateRequest operationCreateRequest = new OperationCreateRequest();
operationCreateRequest.setApplications(Collections.singletonList(APP_ID));
operationCreateRequest.setTemplateName(TEMPLATE_NAME);
operationCreateRequest.setTimestampExpires(new Date(Instant.now()
.plusSeconds(TimeUnit.MINUTES.toSeconds(60)).toEpochMilli()));
operationCreateRequest.setUserId("test_user_id");
final String operationId = operationService.createOperation(operationCreateRequest).getId();
final String userId = "user_" + UUID.randomUUID();
final OperationClaimRequest claimRequest = new OperationClaimRequest();
claimRequest.setOperationId(operationId);
claimRequest.setUserId(userId);
final Exception exception = assertThrows(GenericServiceException.class, () -> {
operationService.operationClaim(claimRequest);
});
assertEquals("Operation was not found.", exception.getMessage());
}

@Test
void testOperationApproveWithValidProximityOtp() throws Exception {
final OperationDetailResponse operation = createOperation(true);
Expand Down

0 comments on commit 1cf7657

Please sign in to comment.