in ddm-rrm/src/it/java/com/epam/digital/data/platform/management/CandidateVersionFormsControllerIT.java [129:161]
void getFormsByVersionId() {
// add files to "remote" repo
final var johnDoesFormContent = context.getResourceContent(
"/versions/candidates/{versionCandidateId}/forms/GET/john-does-form.json");
context.addFileToRemoteHeadRepo("/forms/john-does-form.json", johnDoesFormContent);
final var mrSmithsFormContent = context.getResourceContent(
"/versions/candidates/{versionCandidateId}/forms/GET/mr-smiths-form.json");
context.addFileToRemoteHeadRepo("/forms/mr-smiths-form.json", mrSmithsFormContent);
// mock gerrit change info for version candidate
final var versionCandidateId = context.createVersionCandidate();
// define expected john-does-form dates
final var expectedJohnDoesFormDates = context.getHeadRepoDatesByPath(
"forms/john-does-form.json");
// perform query
mockMvc.perform(
get("/versions/candidates/{versionCandidateId}/forms", versionCandidateId)
.accept(MediaType.APPLICATION_JSON)
).andExpectAll(
status().isOk(),
content().contentType(MediaType.APPLICATION_JSON),
jsonPath("$[0].name", is("john-does-form")),
jsonPath("$[0].title", is("John Doe's form")),
jsonPath("$[0].created", is(expectedJohnDoesFormDates.getCreated())),
jsonPath("$[0].updated", is(expectedJohnDoesFormDates.getUpdated())),
jsonPath("$[1].name", is("mr-smiths-form")),
jsonPath("$[1].title", is("Mr Smith's form")),
jsonPath("$[1].created", is("2022-10-28T20:21:48.845Z")),
jsonPath("$[1].updated", is("2022-10-28T20:56:32.309Z"))
);
}