void shouldMake5RetriesWhenUnauthorized()

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


  void shouldMake5RetriesWhenUnauthorized() throws IOException {
    // given
    customizeImportUsers(mockKeycloakServer, 401, "json/partial-import-response.json");

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

    // when
    assertThrows(RetryableException.class, () -> userPublishingService.publish(fileObject.getId()));

    // then
    mockKeycloakServer.verify(5,
        postRequestedFor(urlEqualTo("/auth/admin/realms/some-realm/partialImport")));
  }