diff --git a/src/test/java/de/ozgcloud/eingang/intelliform/FormDataEndpointITCase.java b/src/test/java/de/ozgcloud/eingang/intelliform/FormDataEndpointITCase.java index b565bf3b9bbb0f7f5dd0a7b9d3c7160f890b32f0..d65f6776e38bf01ed14af5411f762528202063c0 100644 --- a/src/test/java/de/ozgcloud/eingang/intelliform/FormDataEndpointITCase.java +++ b/src/test/java/de/ozgcloud/eingang/intelliform/FormDataEndpointITCase.java @@ -117,8 +117,6 @@ class FormDataEndpointITCase { private MockWebServiceClient mockClient; - private DepositData depositData; - private final String vorgangId = UUID.randomUUID().toString(); @BeforeAll @@ -146,15 +144,12 @@ class FormDataEndpointITCase { @Nested class TestSendAntragWithManyAttachments { - @BeforeEach - void mock() { - depositData = DepositDataTestFactory.create(MANY_ATTACHMENTS); - } + private final DepositData depositData = DepositDataTestFactory.create(MANY_ATTACHMENTS); @DisplayName("should map antragsteller nachname") @Test void shouldMapAntragstellerNachname() { - sendDepositAndCaptureCreateVorgang(); + sendDepositAndCaptureCreateVorgang(depositData); var antragsteller = getCapturedAntragsteller(); assertThat(antragsteller.getNachname()).isEqualTo(ANTRAGSTELLER_NACHNAME); @@ -163,7 +158,7 @@ class FormDataEndpointITCase { @DisplayName("should map antragsteller anrede") @Test void shouldMapAntragstellerAnrede() { - sendDepositAndCaptureCreateVorgang(); + sendDepositAndCaptureCreateVorgang(depositData); var antragsteller = getCapturedAntragsteller(); assertThat(antragsteller.getAnrede()).isEqualTo(ANTRAGSTELLER_ANREDE); @@ -176,7 +171,7 @@ class FormDataEndpointITCase { @DisplayName("should have representations") @Test void shouldHaveRepresentations() { - sendDepositAndCaptureCreateVorgang(); + sendDepositAndCaptureCreateVorgang(depositData); var eingang = grpcEingangCaptor.getValue(); var representationVendorIds = eingang.getRepresentationsList().stream() @@ -191,7 +186,7 @@ class FormDataEndpointITCase { @DisplayName("should have attachments") @Test void shouldHaveAttachments() { - sendDepositAndCaptureCreateVorgang(); + sendDepositAndCaptureCreateVorgang(depositData); var eingang = grpcEingangCaptor.getValue(); var attachmentVendorIds = eingang.getAttachmentsList().stream() @@ -218,7 +213,7 @@ class FormDataEndpointITCase { @DisplayName("should have organisationseinheitenID") @Test void shouldHaveOrganisationseinheitenId() { - sendDepositAndCaptureCreateVorgang(); + sendDepositAndCaptureCreateVorgang(depositData); var eingang = grpcEingangCaptor.getValue(); assertThat(eingang.getZustaendigeStelle().getOrganisationseinheitenId()).isEqualTo(ORGANISATIONSEINHEITEN_ID); @@ -229,16 +224,14 @@ class FormDataEndpointITCase { @DisplayName("with duplicate keys") @Nested class TestWithDuplicateKeys { - @BeforeEach - void mock() { - depositData = DepositDataTestFactory.create(List.of( - withEmptyName(createXmlDaten()), - createXmlDaten(), - withEmptyName(createPdf()), - createPdf(), - withEmptyName(createPng()), - createPng())); - } + + private final DepositData depositData = DepositDataTestFactory.create(List.of( + withEmptyName(createXmlDaten()), + createXmlDaten(), + withEmptyName(createPdf()), + createPdf(), + withEmptyName(createPng()), + createPng())); private Attachment withEmptyName(Attachment attachment) { attachment.setName(""); @@ -248,7 +241,7 @@ class FormDataEndpointITCase { @DisplayName("should keep last entry for representations") @Test void shouldKeepLastEntryForRepresentations() { - sendDepositAndCaptureCreateVorgang(); + sendDepositAndCaptureCreateVorgang(depositData); var eingang = grpcEingangCaptor.getValue(); var representationFiles = eingang.getRepresentationsList(); @@ -259,7 +252,7 @@ class FormDataEndpointITCase { @DisplayName("should keep last entry for attachments") @Test void shouldKeepLastEntryForAttachments() { - sendDepositAndCaptureCreateVorgang(); + sendDepositAndCaptureCreateVorgang(depositData); var eingang = grpcEingangCaptor.getValue(); var attachmentFiles = eingang.getAttachmentsList().stream() @@ -284,7 +277,7 @@ class FormDataEndpointITCase { } @SneakyThrows - private void sendDepositAndCaptureCreateVorgang() { + private void sendDepositAndCaptureCreateVorgang(DepositData depositData) { mockClient.sendRequest(RequestCreators.withPayload(createEnvelopeSourceFromDepositData(depositData))) .andExpect(ResponseMatchers.noFault()) .andExpect(ResponseMatchers.payload(getResource(RESPONSE)));