Skip to content
Snippets Groups Projects
Commit 65ef2700 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-4857 OZG-4934 replace spy call with annotation

parent b17ff10e
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,7 @@ import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.MockedStatic;
import org.mockito.Spy;
import de.ozgcloud.alfa.common.FormatTypeTestFactory;
import de.ozgcloud.alfa.common.PrimaerdokumentTypeBuilder;
......@@ -34,10 +35,11 @@ class DokumentTypeBuilderTest {
private static final String FORM_ENGINE_NAME = "DUMMY_NAME";
private final OzgFile ozgFile = OzgFileTestFactory.create();
private final DokumentTypeBuilder builder = spy(DokumentTypeBuilder.builder()
@Spy
private final DokumentTypeBuilder builder = DokumentTypeBuilder.builder()
.withOzgFile(ozgFile)
.withFormEngineName(FORM_ENGINE_NAME)
.withOrdinalNumber(DOKUMENT_ORDINAL_NUMBER));
.withOrdinalNumber(DOKUMENT_ORDINAL_NUMBER);
private MockedStatic<UUIDConverter> uuidConverter;
......
......@@ -12,6 +12,7 @@ import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.MockedStatic;
import org.mockito.Spy;
import de.ozgcloud.alfa.common.DateiformatCodeTypeTestFactory;
import de.ozgcloud.alfa.common.FormatTypeTestFactory;
......@@ -29,7 +30,8 @@ import de.xoev.xdomea.VersionType;
class DokumentTypeBuilderTest {
private DokumentTypeBuilder builder = spy(DokumentTypeBuilder.builder());
@Spy
private DokumentTypeBuilder builder = DokumentTypeBuilder.builder();
@Nested
class TestBuild {
......@@ -41,7 +43,6 @@ class DokumentTypeBuilderTest {
@BeforeEach
void setUp() {
doReturn(identifikationObjektType).when(builder).createKommentarIdentifikation();
doReturn(anlageDokumentType).when(builder).createAnlage(ozgFile);
}
@Test
......@@ -51,6 +52,9 @@ class DokumentTypeBuilderTest {
verify(builder).createKommentarIdentifikation();
}
@Nested
class WithoutKommentareAttachments {
@Test
void shouldHaveIdentifikation() {
var dokumentType = builder.build();
......@@ -64,6 +68,15 @@ class DokumentTypeBuilderTest {
assertThat(dokumentType.getTyp()).isEqualTo(DokumentTypeBuilder.TYP);
}
}
@Nested
class WithKommentareAttachments {
@BeforeEach
void setUp() {
doReturn(anlageDokumentType).when(builder).createAnlage(ozgFile);
}
@Test
void shouldCreateAnlagenForKommentarAttachments() {
......@@ -79,6 +92,7 @@ class DokumentTypeBuilderTest {
assertThat(dokumentType.getAnlage()).contains(anlageDokumentType);
}
}
}
@Nested
class TestCreateKommentarIdentifikation {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment