Skip to content
Snippets Groups Projects
Commit 68b2b76d authored by OZGCloud's avatar OZGCloud
Browse files

OZG-5286 direct set number of Representations

parent ca96e3c4
Branches
Tags
No related merge requests found
......@@ -72,9 +72,7 @@ public class EntryController {
var builder = formData.toBuilder();
representations.stream().map(this::buildIncomingFile).forEach(builder::representation);
var result = builder.build();
return result.toBuilder().numberOfRepresentations(result.getRepresentations().size()).build();
return builder.numberOfRepresentations(representations.size()).build();
}
FormData addAttachments(Collection<MultipartFile> attachments, FormData formData) {
......
......@@ -137,6 +137,13 @@ class EntryControllerTest {
assertThat(formData.getRepresentations()).hasSize(2);
}
@Test
void shouldSetNumberOfRepresentations() {
var formData = doPostRequest();
assertThat(formData.getNumberOfRepresentations()).isEqualTo(2);
}
@SneakyThrows
private FormData doPostRequest() {
mockMvc.perform(multipart("/antrag")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment