void shouldThrowJwtObtainingExceptionWhenTryToGetAccessTokenButReturns401()

in src/it/java/com/epam/digital/data/platform/user/service/KeycloakServiceTest.java [167:179]


  void shouldThrowJwtObtainingExceptionWhenTryToGetAccessTokenButReturns401() throws IOException {
    // given
    customizeGetAccessToken(mockKeycloakServer, 401, "json/keycloak-access-token.json");

    var fileObject = getFileObject("json/users.csv");
    when(fileService.getFile(fileObject.getId())).thenReturn(fileObject);
    var contentStr = new String(fileObject.getContent(), StandardCharsets.UTF_8);
    when(vaultService.decrypt(contentStr)).thenReturn(contentStr);

    // when, then
    assertThrows(JwtObtainingException.class,
        () -> userPublishingService.publish(fileObject.getId()));
  }