@SneakyThrows
@Test
void getVersionsTest() {

    when(versionedDatasafeServices.versionInfo()).thenReturn(versionInfoService);
    Uri location = new Uri("s3://bucket/user/path/to/file.txt");
    PrivateResource privateResource = new BasePrivateResource(location).resolve(new Uri("/path/to/file.txt"), new Uri("/path/to/file.txt"));
    BaseResolvedResource resolvedResource = new BaseResolvedResource(privateResource, Instant.now());
    AbsoluteLocation<PrivateResource> absoluteLocation = new AbsoluteLocation<>(privateResource);
    BaseVersionedPath<PrivateResource, ResolvedResource, Version> versionedPath =
            new BaseVersionedPath<>(new DFSVersion("1"), absoluteLocation, resolvedResource);
    when(versionedPrivateSpaceService.listWithDetails(any())).thenReturn(Stream.of(versionedPath));
    RestDocumentationResultHandler document = document("versions-list-success",
            pathParameters(
                    parameterWithName("path").description("path to the file")
            ),
            requestHeaders(
                    headerWithName("token").description(TOKEN_DESCRIPTION),
                    headerWithName("user").description(USER_DESCRIPTION),
                    headerWithName("password").description(PASSWORD_DESCRIPTION)
            )
    );
    String path = "path/to/file";
    mvc.perform(get("/versions/list/{path}", path)
            .contentType(MediaType.APPLICATION_JSON_VALUE)
            .header("user", TEST_USER)
            .header("password", TEST_PASS)
            .header("token", token)
    ).andExpect(status().isOk())
            .andExpect(content().string("[]"))
            .andDo(document);
    verify(versionInfoService).versionsOf(any());
}