Skip to content
Snippets Groups Projects
Commit 40528ed4 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-5665 Added EqualsAndHashCode to OzgFile

parent 800b792a
Branches
Tags
No related merge requests found
...@@ -29,6 +29,7 @@ import de.ozgcloud.alfa.common.binaryfile.FileId; ...@@ -29,6 +29,7 @@ import de.ozgcloud.alfa.common.binaryfile.FileId;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
...@@ -36,10 +37,13 @@ import lombok.NoArgsConstructor; ...@@ -36,10 +37,13 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor(access = AccessLevel.PRIVATE) @NoArgsConstructor(access = AccessLevel.PRIVATE)
@AllArgsConstructor(access = AccessLevel.PACKAGE) @AllArgsConstructor(access = AccessLevel.PACKAGE)
@Getter @Getter
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
public class OzgFile { public class OzgFile {
@JsonIgnore @JsonIgnore
@EqualsAndHashCode.Include
private FileId id; private FileId id;
@EqualsAndHashCode.Include
private String name; private String name;
private long size; private long size;
......
...@@ -259,12 +259,12 @@ class PostfachMailServiceTest { ...@@ -259,12 +259,12 @@ class PostfachMailServiceTest {
class TestCall { class TestCall {
private final Stream<PostfachMail> postfachMail = Stream.of(postfachNachricht); private final Stream<PostfachMail> postfachMail = Stream.of(postfachNachricht);
private final Stream<OzgFile> ozgFile = Stream.of(OzgFileTestFactory.create()); private final Stream<OzgFile> ozgFiles = Stream.of(OzgFileTestFactory.create());
@BeforeEach @BeforeEach
void mock() { void mock() {
when(remoteService.findPostfachMails(anyString())).thenReturn(postfachMail); when(remoteService.findPostfachMails(anyString())).thenReturn(postfachMail);
when(fileService.getFiles(anyList())).thenReturn(ozgFile); when(fileService.getFiles(anyList())).thenReturn(ozgFiles);
} }
@Test @Test
......
...@@ -34,7 +34,7 @@ import de.xoev.xdomea.IdentifikationObjektType; ...@@ -34,7 +34,7 @@ import de.xoev.xdomea.IdentifikationObjektType;
class DokumentTypeBuilderTest { class DokumentTypeBuilderTest {
private final String fullName = UserProfileTestFactory.FULLNAME; private final String fullName = UserProfileTestFactory.FULLNAME;
private final Bescheid bescheid = BescheidTestFactory.create(); private final Bescheid bescheid = BescheidTestFactory.create();
private final OzgFile document = OzgFileTestFactory.create(); private final OzgFile document = OzgFileTestFactory.createWithUniqueId();
@Spy @Spy
private final DokumentTypeBuilder builder = DokumentTypeBuilder.builder() private final DokumentTypeBuilder builder = DokumentTypeBuilder.builder()
...@@ -149,7 +149,7 @@ class DokumentTypeBuilderTest { ...@@ -149,7 +149,7 @@ class DokumentTypeBuilderTest {
@Nested @Nested
class TestWithOneAnlage { class TestWithOneAnlage {
private final AnlageDokumentType anlageDokumentAttachment = AnlageDokumentTypeTestFactory.create(); private final AnlageDokumentType anlageDokumentAttachment = AnlageDokumentTypeTestFactory.create();
private final OzgFile attachment = OzgFileTestFactory.create(); private final OzgFile attachment = OzgFileTestFactory.createWithUniqueId();
@Test @Test
void shouldHaveOneAnlage() { void shouldHaveOneAnlage() {
...@@ -250,7 +250,7 @@ class DokumentTypeBuilderTest { ...@@ -250,7 +250,7 @@ class DokumentTypeBuilderTest {
@Mock @Mock
private AnlageDokumentTypeBuilder anlageDokumentTypeBuilder; private AnlageDokumentTypeBuilder anlageDokumentTypeBuilder;
private final AnlageDokumentType expectedAnlage = AnlageDokumentTypeTestFactory.create(); private final AnlageDokumentType expectedAnlage = AnlageDokumentTypeTestFactory.create();
private final OzgFile attachment = OzgFileTestFactory.create(); private final OzgFile attachment = OzgFileTestFactory.createWithUniqueId();
@BeforeEach @BeforeEach
void setUp() { void setUp() {
......
...@@ -154,8 +154,8 @@ class ExportBescheidServiceTest { ...@@ -154,8 +154,8 @@ class ExportBescheidServiceTest {
class TestCreateBescheidExportInput { class TestCreateBescheidExportInput {
private final VorgangWithEingang vorgang = VorgangWithEingangTestFactory.create(); private final VorgangWithEingang vorgang = VorgangWithEingangTestFactory.create();
private final Bescheid bescheid = BescheidTestFactory.create(); private final Bescheid bescheid = BescheidTestFactory.create();
private final OzgFile document = OzgFileTestFactory.create(); private final OzgFile document = OzgFileTestFactory.createWithUniqueId();
private final OzgFile attachment = OzgFileTestFactory.create(); private final OzgFile attachment = OzgFileTestFactory.createWithUniqueId();
@BeforeEach @BeforeEach
void setUpMocks() { void setUpMocks() {
...@@ -243,7 +243,7 @@ class ExportBescheidServiceTest { ...@@ -243,7 +243,7 @@ class ExportBescheidServiceTest {
@Test @Test
void shouldReturnGottenOzgFiles() { void shouldReturnGottenOzgFiles() {
var expectedOzgFile = OzgFileTestFactory.create(); var expectedOzgFile = OzgFileTestFactory.createWithUniqueId();
when(binaryFileService.getFiles(fileIds)).thenReturn(Stream.of(expectedOzgFile)); when(binaryFileService.getFiles(fileIds)).thenReturn(Stream.of(expectedOzgFile));
var resultOzgFiles = service.getAttachments(bescheid); var resultOzgFiles = service.getAttachments(bescheid);
...@@ -255,7 +255,6 @@ class ExportBescheidServiceTest { ...@@ -255,7 +255,6 @@ class ExportBescheidServiceTest {
@Nested @Nested
class TestAddBescheidExportData { class TestAddBescheidExportData {
private final List<OzgFile> files = BescheidExportInputTestFactory.FILES; private final List<OzgFile> files = BescheidExportInputTestFactory.FILES;
private final OzgFile document = OzgFileTestFactory.create();
private final DokumentType dokumentType = DokumentTypeTestFactory.create(); private final DokumentType dokumentType = DokumentTypeTestFactory.create();
private final BescheidExportInput exportInput = BescheidExportInputTestFactory.create(); private final BescheidExportInput exportInput = BescheidExportInputTestFactory.create();
......
...@@ -16,7 +16,7 @@ import de.ozgcloud.alfa.common.file.OzgFileTestFactory; ...@@ -16,7 +16,7 @@ import de.ozgcloud.alfa.common.file.OzgFileTestFactory;
class PrimaerdokumentTypeBuilderTest { class PrimaerdokumentTypeBuilderTest {
private final PrimaerdokumentTypeBuilder builder = PrimaerdokumentTypeBuilder.builder().withOzgFile(OzgFileTestFactory.create()); private final PrimaerdokumentTypeBuilder builder = PrimaerdokumentTypeBuilder.builder().withOzgFile(OzgFileTestFactory.createWithUniqueId());
@Nested @Nested
class TestBuild { class TestBuild {
...@@ -26,7 +26,7 @@ class PrimaerdokumentTypeBuilderTest { ...@@ -26,7 +26,7 @@ class PrimaerdokumentTypeBuilderTest {
private static final String ERSTELLER = "Ersteller"; private static final String ERSTELLER = "Ersteller";
private static final String GENERATED_FILE_NAME = "file_name"; private static final String GENERATED_FILE_NAME = "file_name";
private static final ZonedDateTime CREATED_AT = ZonedDateTime.now(); private static final ZonedDateTime CREATED_AT = ZonedDateTime.now();
private final OzgFile ozgFile = OzgFileTestFactory.create(); private final OzgFile ozgFile = OzgFileTestFactory.createWithUniqueId();
@BeforeEach @BeforeEach
void setUp() { void setUp() {
......
...@@ -136,8 +136,8 @@ class ExportServiceTest { ...@@ -136,8 +136,8 @@ class ExportServiceTest {
private final NkAbgabeType kopfType = NkAbgabeTypeTestFactory.create(); private final NkAbgabeType kopfType = NkAbgabeTypeTestFactory.create();
private final AbgabeAbgabe0401 abgabe = AbgabeAbgabe0401TestFactory.create(); private final AbgabeAbgabe0401 abgabe = AbgabeAbgabe0401TestFactory.create();
private final AkteType akteType = AkteTypeTestFactory.create(); private final AkteType akteType = AkteTypeTestFactory.create();
private final List<OzgFile> representations = List.of(OzgFileTestFactory.create()); private final List<OzgFile> representations = List.of(OzgFileTestFactory.createWithUniqueId());
private final List<OzgFile> attachments = List.of(OzgFileTestFactory.create()); private final List<OzgFile> attachments = List.of(OzgFileTestFactory.createWithUniqueId());
private final List<DokumentType> representationsDokumentTypes = List.of(DokumentTypeTestFactory.create()); private final List<DokumentType> representationsDokumentTypes = List.of(DokumentTypeTestFactory.create());
private final List<DokumentType> attachmentsDokumentTypes = List.of(DokumentTypeTestFactory.create()); private final List<DokumentType> attachmentsDokumentTypes = List.of(DokumentTypeTestFactory.create());
private final List<HistorienProtokollInformationType> historienProtokollInformationTypes = List.of( private final List<HistorienProtokollInformationType> historienProtokollInformationTypes = List.of(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment