Skip to content
Snippets Groups Projects
Commit 69e9d7d7 authored by Jan Zickermann's avatar Jan Zickermann
Browse files

test: Cleanup itcase

parent 0e4ac069
Branches
Tags
No related merge requests found
...@@ -117,8 +117,6 @@ class FormDataEndpointITCase { ...@@ -117,8 +117,6 @@ class FormDataEndpointITCase {
private MockWebServiceClient mockClient; private MockWebServiceClient mockClient;
private DepositData depositData;
private final String vorgangId = UUID.randomUUID().toString(); private final String vorgangId = UUID.randomUUID().toString();
@BeforeAll @BeforeAll
...@@ -146,15 +144,12 @@ class FormDataEndpointITCase { ...@@ -146,15 +144,12 @@ class FormDataEndpointITCase {
@Nested @Nested
class TestSendAntragWithManyAttachments { class TestSendAntragWithManyAttachments {
@BeforeEach private final DepositData depositData = DepositDataTestFactory.create(MANY_ATTACHMENTS);
void mock() {
depositData = DepositDataTestFactory.create(MANY_ATTACHMENTS);
}
@DisplayName("should map antragsteller nachname") @DisplayName("should map antragsteller nachname")
@Test @Test
void shouldMapAntragstellerNachname() { void shouldMapAntragstellerNachname() {
sendDepositAndCaptureCreateVorgang(); sendDepositAndCaptureCreateVorgang(depositData);
var antragsteller = getCapturedAntragsteller(); var antragsteller = getCapturedAntragsteller();
assertThat(antragsteller.getNachname()).isEqualTo(ANTRAGSTELLER_NACHNAME); assertThat(antragsteller.getNachname()).isEqualTo(ANTRAGSTELLER_NACHNAME);
...@@ -163,7 +158,7 @@ class FormDataEndpointITCase { ...@@ -163,7 +158,7 @@ class FormDataEndpointITCase {
@DisplayName("should map antragsteller anrede") @DisplayName("should map antragsteller anrede")
@Test @Test
void shouldMapAntragstellerAnrede() { void shouldMapAntragstellerAnrede() {
sendDepositAndCaptureCreateVorgang(); sendDepositAndCaptureCreateVorgang(depositData);
var antragsteller = getCapturedAntragsteller(); var antragsteller = getCapturedAntragsteller();
assertThat(antragsteller.getAnrede()).isEqualTo(ANTRAGSTELLER_ANREDE); assertThat(antragsteller.getAnrede()).isEqualTo(ANTRAGSTELLER_ANREDE);
...@@ -176,7 +171,7 @@ class FormDataEndpointITCase { ...@@ -176,7 +171,7 @@ class FormDataEndpointITCase {
@DisplayName("should have representations") @DisplayName("should have representations")
@Test @Test
void shouldHaveRepresentations() { void shouldHaveRepresentations() {
sendDepositAndCaptureCreateVorgang(); sendDepositAndCaptureCreateVorgang(depositData);
var eingang = grpcEingangCaptor.getValue(); var eingang = grpcEingangCaptor.getValue();
var representationVendorIds = eingang.getRepresentationsList().stream() var representationVendorIds = eingang.getRepresentationsList().stream()
...@@ -191,7 +186,7 @@ class FormDataEndpointITCase { ...@@ -191,7 +186,7 @@ class FormDataEndpointITCase {
@DisplayName("should have attachments") @DisplayName("should have attachments")
@Test @Test
void shouldHaveAttachments() { void shouldHaveAttachments() {
sendDepositAndCaptureCreateVorgang(); sendDepositAndCaptureCreateVorgang(depositData);
var eingang = grpcEingangCaptor.getValue(); var eingang = grpcEingangCaptor.getValue();
var attachmentVendorIds = eingang.getAttachmentsList().stream() var attachmentVendorIds = eingang.getAttachmentsList().stream()
...@@ -218,7 +213,7 @@ class FormDataEndpointITCase { ...@@ -218,7 +213,7 @@ class FormDataEndpointITCase {
@DisplayName("should have organisationseinheitenID") @DisplayName("should have organisationseinheitenID")
@Test @Test
void shouldHaveOrganisationseinheitenId() { void shouldHaveOrganisationseinheitenId() {
sendDepositAndCaptureCreateVorgang(); sendDepositAndCaptureCreateVorgang(depositData);
var eingang = grpcEingangCaptor.getValue(); var eingang = grpcEingangCaptor.getValue();
assertThat(eingang.getZustaendigeStelle().getOrganisationseinheitenId()).isEqualTo(ORGANISATIONSEINHEITEN_ID); assertThat(eingang.getZustaendigeStelle().getOrganisationseinheitenId()).isEqualTo(ORGANISATIONSEINHEITEN_ID);
...@@ -229,16 +224,14 @@ class FormDataEndpointITCase { ...@@ -229,16 +224,14 @@ class FormDataEndpointITCase {
@DisplayName("with duplicate keys") @DisplayName("with duplicate keys")
@Nested @Nested
class TestWithDuplicateKeys { class TestWithDuplicateKeys {
@BeforeEach
void mock() { private final DepositData depositData = DepositDataTestFactory.create(List.of(
depositData = DepositDataTestFactory.create(List.of(
withEmptyName(createXmlDaten()), withEmptyName(createXmlDaten()),
createXmlDaten(), createXmlDaten(),
withEmptyName(createPdf()), withEmptyName(createPdf()),
createPdf(), createPdf(),
withEmptyName(createPng()), withEmptyName(createPng()),
createPng())); createPng()));
}
private Attachment withEmptyName(Attachment attachment) { private Attachment withEmptyName(Attachment attachment) {
attachment.setName(""); attachment.setName("");
...@@ -248,7 +241,7 @@ class FormDataEndpointITCase { ...@@ -248,7 +241,7 @@ class FormDataEndpointITCase {
@DisplayName("should keep last entry for representations") @DisplayName("should keep last entry for representations")
@Test @Test
void shouldKeepLastEntryForRepresentations() { void shouldKeepLastEntryForRepresentations() {
sendDepositAndCaptureCreateVorgang(); sendDepositAndCaptureCreateVorgang(depositData);
var eingang = grpcEingangCaptor.getValue(); var eingang = grpcEingangCaptor.getValue();
var representationFiles = eingang.getRepresentationsList(); var representationFiles = eingang.getRepresentationsList();
...@@ -259,7 +252,7 @@ class FormDataEndpointITCase { ...@@ -259,7 +252,7 @@ class FormDataEndpointITCase {
@DisplayName("should keep last entry for attachments") @DisplayName("should keep last entry for attachments")
@Test @Test
void shouldKeepLastEntryForAttachments() { void shouldKeepLastEntryForAttachments() {
sendDepositAndCaptureCreateVorgang(); sendDepositAndCaptureCreateVorgang(depositData);
var eingang = grpcEingangCaptor.getValue(); var eingang = grpcEingangCaptor.getValue();
var attachmentFiles = eingang.getAttachmentsList().stream() var attachmentFiles = eingang.getAttachmentsList().stream()
...@@ -284,7 +277,7 @@ class FormDataEndpointITCase { ...@@ -284,7 +277,7 @@ class FormDataEndpointITCase {
} }
@SneakyThrows @SneakyThrows
private void sendDepositAndCaptureCreateVorgang() { private void sendDepositAndCaptureCreateVorgang(DepositData depositData) {
mockClient.sendRequest(RequestCreators.withPayload(createEnvelopeSourceFromDepositData(depositData))) mockClient.sendRequest(RequestCreators.withPayload(createEnvelopeSourceFromDepositData(depositData)))
.andExpect(ResponseMatchers.noFault()) .andExpect(ResponseMatchers.noFault())
.andExpect(ResponseMatchers.payload(getResource(RESPONSE))); .andExpect(ResponseMatchers.payload(getResource(RESPONSE)));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment