Skip to content

Commit

Permalink
reviewed changes
Browse files Browse the repository at this point in the history
Signed-off-by: Venkata Saidurga Polamraju <saidurgacsea@gmail.com>
  • Loading branch information
pvsaidurga committed May 31, 2024
1 parent 2d9534f commit 90e355a
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -472,17 +472,25 @@ public void getOauthDetailsV2_withInvalidRedirectUri_throwsException() throws Es
public void testGetOauthDetailsV3_WithInvalidIdTokenHint_ShouldThrowEsignetException() {
OAuthDetailRequestV3 oauthDetailReqDto = new OAuthDetailRequestV3();
oauthDetailReqDto.setIdTokenHint("invalid_id_token_hint");
Assert.assertThrows(EsignetException.class, () ->
authorizationServiceImpl.getOauthDetailsV3(oauthDetailReqDto, httpServletRequest));
try {
authorizationServiceImpl.getOauthDetailsV3(oauthDetailReqDto, httpServletRequest);
Assert.fail();
}catch (EsignetException e){
Assert.assertTrue(e.getErrorCode().equals(ErrorConstants.INVALID_ID_TOKEN_HINT));
}
}

@Test
public void getOauthDetailsV3_WithCookieNotPresent_ThrowsEsignetException() {
OAuthDetailRequestV3 oauthDetailReqDto = new OAuthDetailRequestV3();
oauthDetailReqDto.setIdTokenHint("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.3RJf1g9bKzRC-dEj4b2Jx2yCk7Mz4oG1bZbDqGt8QxE");
Mockito.when(httpServletRequest.getCookies()).thenReturn(new Cookie[]{});
Assert.assertThrows(EsignetException.class, () ->
authorizationServiceImpl.getOauthDetailsV3(oauthDetailReqDto, httpServletRequest));
try {
authorizationServiceImpl.getOauthDetailsV3(oauthDetailReqDto, httpServletRequest);
Assert.fail();
}catch (EsignetException e){
Assert.assertTrue(e.getErrorCode().equals(ErrorConstants.INVALID_ID_TOKEN_HINT));
}
}

@Test
Expand Down

0 comments on commit 90e355a

Please sign in to comment.