Skip to content
Snippets Groups Projects
Commit 569b9139 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-4367 extend tests

parent f94a0063
Branches
Tags
No related merge requests found
......@@ -71,6 +71,8 @@ class FormDataControllerTest {
private SemantikAdapter semantikAdapter;
@Mock
private VorgangNummerSupplier vorgangNummerSupplier;
@Mock
private FormDataHtmlCleaner htmlCleaner;
private MockMvc mockMvc;
......@@ -93,6 +95,7 @@ class FormDataControllerTest {
@BeforeEach
void init() {
when(htmlCleaner.clean(any())).thenReturn(mappedFormData);
when(mapper.toFormData(any())).thenReturn(mappedFormData);
when(vorgangNummerSupplier.get()).thenReturn(VORGANG_NUMMER);
}
......@@ -111,7 +114,7 @@ class FormDataControllerTest {
@Test
@SneakyThrows
void shouldRespondeWithVorgangNummer() {
void shouldResponseWithVorgangNummer() {
var confirmation = FormCycleConfirmationResponse.parseFrom(
doPostRequest().andReturn().getResponse().getContentAsByteArray());
......@@ -127,6 +130,13 @@ class FormDataControllerTest {
assertThat(formDataCaptor.getValue().getHeader().getRequestId()).isEqualTo(VORGANG_NUMMER);
}
@Test
void shouldCallHtmlCleaner() {
doPostRequest();
verify(htmlCleaner).clean(any());
}
@Test
void shouldCallMapper() {
doPostRequest();
......@@ -157,8 +167,9 @@ class FormDataControllerTest {
@BeforeEach
void init() {
when(mapper.toFormData(any()))
.thenReturn(FormDataTestFactory.createBuilder().clearRepresentations().numberOfRepresentations(0).build());
var formData = FormDataTestFactory.createBuilder().clearRepresentations().numberOfRepresentations(0).build();
when(mapper.toFormData(any())).thenReturn(formData);
when(htmlCleaner.clean(any())).thenReturn(formData);
}
@Test
......@@ -195,8 +206,9 @@ class FormDataControllerTest {
class Attachments {
@BeforeEach
void init() {
when(mapper.toFormData(any()))
.thenReturn(FormDataTestFactory.createBuilder().clearAttachments().numberOfAttachments(0).build());
var formData = FormDataTestFactory.createBuilder().clearAttachments().numberOfAttachments(0).build();
when(mapper.toFormData(any())).thenReturn(formData);
when(htmlCleaner.clean(any())).thenReturn(formData);
}
@Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment