diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/adapter/input/restapi/controller/ProprietaryControllerTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/adapter/input/restapi/controller/ProprietaryControllerTest.java index 88c941dd4..9fe7be4c0 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/adapter/input/restapi/controller/ProprietaryControllerTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/adapter/input/restapi/controller/ProprietaryControllerTest.java @@ -192,29 +192,26 @@ void updatesProprietarySuccess() throws Exception { final String eli = "eli/bund/bgbl-1/1990/s2954/2022-12-19/1/deu/regelungstext-1"; final LocalDate date = LocalDate.parse("1990-01-01"); - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - - - - new-fna - new-art - new-typ - new-subtyp - new-bezeichnungInVorlage - SN,ÄN,ÜN - DEU - Bundestag - Andere Organisationseinheit - - - """ - ) + final Proprietary proprietary = new Proprietary( + XmlMapper.toNode( + """ + + + + new-fna + new-art + new-typ + new-subtyp + new-bezeichnungInVorlage + SN,ÄN,ÜN + DEU + Bundestag + Andere Organisationseinheit + + + """ ) - .build(); + ); when(updateProprietaryFrameFromNormUseCase.updateProprietaryFrameFromNorm(any())) .thenReturn(proprietary); @@ -425,25 +422,22 @@ void updatesProprietarySuccess() throws Exception { var eid = "hauptteil-1_abschnitt-0_art-1"; final LocalDate date = LocalDate.parse("1990-01-01"); - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - - - SN,ÄN,ÜN - - SN - ÄN - ÜN - - - - """ - ) + final Proprietary proprietary = new Proprietary( + XmlMapper.toNode( + """ + + + SN,ÄN,ÜN + + SN + ÄN + ÜN + + + + """ ) - .build(); + ); when( updateProprietarySingleElementFromNormUseCase.updateProprietarySingleElementFromNorm(any()) diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/adapter/input/restapi/mapper/ArticleResponseMapperTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/adapter/input/restapi/mapper/ArticleResponseMapperTest.java index 103be7d75..e87e8106b 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/adapter/input/restapi/mapper/ArticleResponseMapperTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/adapter/input/restapi/mapper/ArticleResponseMapperTest.java @@ -12,43 +12,40 @@ class ArticleResponseMapperTest { @Test void itMapsNormArticleCorrectly() { // Given - var article1 = Article - .builder() - .node( - XmlMapper.toNode( - """ - - Artikel 1 - Änderung des Vereinsgesetzes - - - - - - - Das Vereinsgesetz vom 5. August 1964 (BGBl. I S. 593), das zuletzt durch … geändert worden ist, wird wie folgt geändert: - - - - - 2. - - - In § 20 Absatz 1 Satz 2 wird die Angabe § 9 Abs. 1 Satz 2, Abs. 2 durch die Wörter § 9 Absatz 1 Satz 2, Absatz 2 oder 3 ersetzt. - - - - - - - """ - ) + var article1 = new Article( + XmlMapper.toNode( + """ + + Artikel 1 + Änderung des Vereinsgesetzes + + + + + + + Das Vereinsgesetz vom 5. August 1964 (BGBl. I S. 593), das zuletzt durch … geändert worden ist, wird wie folgt geändert: + + + + + 2. + + + In § 20 Absatz 1 Satz 2 wird die Angabe § 9 Abs. 1 Satz 2, Abs. 2 durch die Wörter § 9 Absatz 1 Satz 2, Absatz 2 oder 3 ersetzt. + + + + + + + """ ) - .build(); + ); // When final ArticleResponseSchema resultArticle = ArticleResponseMapper.fromNormArticle(article1); diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/adapter/input/restapi/mapper/ProprietaryResponseMapperTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/adapter/input/restapi/mapper/ProprietaryResponseMapperTest.java index f8ad2bf9a..2eb981d38 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/adapter/input/restapi/mapper/ProprietaryResponseMapperTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/adapter/input/restapi/mapper/ProprietaryResponseMapperTest.java @@ -11,27 +11,24 @@ class ProprietaryResponseMapperTest { @Test void convertsProprietaryToResponseSchema() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - - - gesetz - 000-00-0 - verkuendungsfassung - - - 111-11-1 - 222-22-2 - 333-33-3 - - - """ - ) + final Proprietary proprietary = new Proprietary( + XmlMapper.toNode( + """ + + + gesetz + 000-00-0 + verkuendungsfassung + + + 111-11-1 + 222-22-2 + 333-33-3 + + + """ ) - .build(); + ); // When var responseSchema = ProprietaryResponseMapper.fromProprietary( @@ -45,24 +42,21 @@ void convertsProprietaryToResponseSchema() { @Test void convertsProprietaryEinzelelementToResponseSchema() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - - - - SN - ÄN - ÜN - - - - """ - ) + final Proprietary proprietary = new Proprietary( + XmlMapper.toNode( + """ + + + + SN + ÄN + ÜN + + + + """ ) - .build(); + ); // When var responseSchema = ProprietaryResponseMapper.fromProprietarySingleElement( diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/AnalysisTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/AnalysisTest.java index 5e699218c..6d3fee24f 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/AnalysisTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/AnalysisTest.java @@ -10,29 +10,26 @@ class AnalysisTest { @Test void getActiveModifications() { - final Analysis analysis = Analysis - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - - - - - """ - ) + final Analysis analysis = new Analysis( + XmlMapper.toNode( + """ + + + + + + + + + + + + + + + """ ) - .build(); + ); // then assertThat(analysis.getActiveModifications()).hasSize(2); @@ -40,17 +37,14 @@ void getActiveModifications() { @Test void getActiveModificationsEmpty() { - final Analysis analysis = Analysis - .builder() - .node( - XmlMapper.toNode( - """ - - - """ - ) + final Analysis analysis = new Analysis( + XmlMapper.toNode( + """ + + + """ ) - .build(); + ); // then assertThat(analysis.getActiveModifications()).isEmpty(); @@ -58,29 +52,26 @@ void getActiveModificationsEmpty() { @Test void getPassiveModifications() { - final Analysis analysis = Analysis - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - - - - - """ - ) + final Analysis analysis = new Analysis( + XmlMapper.toNode( + """ + + + + + + + + + + + + + + + """ ) - .build(); + ); // then assertThat(analysis.getPassiveModifications()).hasSize(2); @@ -88,17 +79,14 @@ void getPassiveModifications() { @Test void getPassiveModificationsEmpty() { - final Analysis analysis = Analysis - .builder() - .node( - XmlMapper.toNode( - """ - - - """ - ) + final Analysis analysis = new Analysis( + XmlMapper.toNode( + """ + + + """ ) - .build(); + ); // then assertThat(analysis.getPassiveModifications()).isEmpty(); @@ -106,29 +94,26 @@ void getPassiveModificationsEmpty() { @Test void getPassiveModificationsNode() { - final Analysis analysis = Analysis - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - - - - - """ - ) + final Analysis analysis = new Analysis( + XmlMapper.toNode( + """ + + + + + + + + + + + + + + + """ ) - .build(); + ); // when final var passiveModificationsNode = analysis.getPassiveModificationsNode(); @@ -141,17 +126,14 @@ void getPassiveModificationsNode() { @Test void getPassiveModificationsNodeEmpty() { - final Analysis analysis = Analysis - .builder() - .node( - XmlMapper.toNode( - """ - - - """ - ) + final Analysis analysis = new Analysis( + XmlMapper.toNode( + """ + + + """ ) - .build(); + ); // when final var passiveModificationsNode = analysis.getPassiveModificationsNode(); @@ -162,17 +144,14 @@ void getPassiveModificationsNodeEmpty() { @Test void itShouldCreatesThePassiveModificationsNodeIfItDoesNotExist() { - final Analysis analysis = Analysis - .builder() - .node( - XmlMapper.toNode( - """ - - - """ - ) + final Analysis analysis = new Analysis( + XmlMapper.toNode( + """ + + + """ ) - .build(); + ); // when final var passiveModificationsNode = analysis.getOrCreatePassiveModificationsNode(); @@ -184,29 +163,26 @@ void itShouldCreatesThePassiveModificationsNodeIfItDoesNotExist() { @Test void itShouldFindThePassiveModificationsNodeIfItExists() { - final Analysis analysis = Analysis - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - - - - - """ - ) + final Analysis analysis = new Analysis( + XmlMapper.toNode( + """ + + + + + + + + + + + + + + + """ ) - .build(); + ); // when final var passiveModificationsNode = analysis.getOrCreatePassiveModificationsNode(); @@ -219,24 +195,21 @@ void itShouldFindThePassiveModificationsNodeIfItExists() { @Test void itShouldCreateANewPassiveModificationWithoutUpTo() { - final Analysis analysis = Analysis - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - """ - ) + final Analysis analysis = new Analysis( + XmlMapper.toNode( + """ + + + + + + + + + + """ ) - .build(); + ); assertThat(analysis.getPassiveModifications()).hasSize(1); analysis.addPassiveModification( @@ -265,24 +238,21 @@ void itShouldCreateANewPassiveModificationWithoutUpTo() { @Test void itShouldCreateANewPassiveModificationWithUpTo() { - final Analysis analysis = Analysis - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - """ - ) + final Analysis analysis = new Analysis( + XmlMapper.toNode( + """ + + + + + + + + + + """ ) - .build(); + ); assertThat(analysis.getPassiveModifications()).hasSize(1); analysis.addPassiveModification( @@ -313,29 +283,26 @@ void itShouldCreateANewPassiveModificationWithUpTo() { @Test void itShouldDeleteAPassiveModificationsNodeIfItExists() { - final Analysis analysis = Analysis - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - - - - - """ - ) + final Analysis analysis = new Analysis( + XmlMapper.toNode( + """ + + + + + + + + + + + + + + + """ ) - .build(); + ); // when final var passiveModifications = analysis.getPassiveModifications(); @@ -349,24 +316,21 @@ void itShouldDeleteAPassiveModificationsNodeIfItExists() { @Test void itShouldDeletePassiveModificationsIfItIsEmptyAfterDeletingAPassiveModification() { - final Analysis analysis = Analysis - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - """ - ) + final Analysis analysis = new Analysis( + XmlMapper.toNode( + """ + + + + + + + + + + """ ) - .build(); + ); // when final var passiveModifications = analysis.getPassiveModifications(); diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/EinzelelementTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/EinzelelementTest.java index e3fc74066..ab406d8a8 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/EinzelelementTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/EinzelelementTest.java @@ -14,20 +14,17 @@ class getMetadatum { @Test void getArtDerNormAtDate() { - final Einzelelement e = Einzelelement - .builder() - .node( - XmlMapper.toNode( - """ - - SN - ÄN - ÜN - - """ - ) + final Einzelelement e = new Einzelelement( + XmlMapper.toNode( + """ + + SN + ÄN + ÜN + + """ ) - .build(); + ); assertThat( e.getSimpleMetadatum(Einzelelement.Metadata.ART_DER_NORM, LocalDate.parse("1980-01-01")) diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/EventRefTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/EventRefTest.java index 1a4b3ce56..703c2ec3e 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/EventRefTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/EventRefTest.java @@ -10,16 +10,13 @@ class EventRefTest { @Test void getDate() { - final EventRef eventRef = EventRef - .builder() - .node( - XmlMapper.toNode( - """ - - """ - ) + final EventRef eventRef = new EventRef( + XmlMapper.toNode( + """ + + """ ) - .build(); + ); // then assertThat(eventRef.getDate()).contains(LocalDate.parse("2017-03-15")); @@ -27,16 +24,13 @@ void getDate() { @Test void getDateEmpty() { - final EventRef eventRef = EventRef - .builder() - .node( - XmlMapper.toNode( - """ - - """ - ) + final EventRef eventRef = new EventRef( + XmlMapper.toNode( + """ + + """ ) - .build(); + ); // then assertThat(eventRef.getDate()).isEmpty(); @@ -45,19 +39,16 @@ void getDateEmpty() { @Test void createEventRef() { // given - final Lifecycle lifecycle = Lifecycle - .builder() - .node( - XmlMapper.toNode( - """ - - - - - """ - ) + final Lifecycle lifecycle = new Lifecycle( + XmlMapper.toNode( + """ + + + + + """ ) - .build(); + ); // when var eventRef = lifecycle.addEventRef(); diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/FRBRExpressionTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/FRBRExpressionTest.java index 3eb349dc1..3210945ef 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/FRBRExpressionTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/FRBRExpressionTest.java @@ -15,21 +15,18 @@ class FRBRExpressionTest { @Test void getFRBRaliasPreviousVersionId() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + + + """ ) - .build(); + ); assertThat(frbrExpression.getFRBRaliasPreviousVersionId().map(UUID::toString)) .contains("123577e5-66ba-48f5-a6eb-db40bcfd6b87"); @@ -37,41 +34,35 @@ void getFRBRaliasPreviousVersionId() { @Test void getFRBRaliasPreviousVersionIdEmpty() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + + """ ) - .build(); + ); assertThat(frbrExpression.getFRBRaliasPreviousVersionId()).isEmpty(); } @Test void setFRBRaliasPreviousVersionIdByReplacing() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + + + """ ) - .build(); + ); final UUID newPreviousVersion = UUID.randomUUID(); frbrExpression.setFRBRaliasPreviousVersionId(newPreviousVersion); @@ -81,21 +72,18 @@ void setFRBRaliasPreviousVersionIdByReplacing() { @Test void setFRBRaliasPreviousVersionIdByAdding() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - This would have to exist in a valid document and we need it to insert the next version ID in order - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + This would have to exist in a valid document and we need it to insert the next version ID in order + + """ ) - .build(); + ); final UUID newPreviousVersion = UUID.randomUUID(); frbrExpression.setFRBRaliasPreviousVersionId(newPreviousVersion); @@ -105,21 +93,18 @@ void setFRBRaliasPreviousVersionIdByAdding() { @Test void getFRBRaliasCurrentVersionId() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + + + """ ) - .build(); + ); assertThat(frbrExpression.getFRBRaliasCurrentVersionId().toString()) .hasToString("ba44d2ae-0e73-44ba-850a-932ab2fa553f"); @@ -127,20 +112,17 @@ void getFRBRaliasCurrentVersionId() { @Test void getFRBRaliasCurrentVersionIdNotFound() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + + """ ) - .build(); + ); assertThatThrownBy(frbrExpression::getFRBRaliasCurrentVersionId) .isInstanceOf(MandatoryNodeNotFoundException.class); @@ -148,21 +130,18 @@ void getFRBRaliasCurrentVersionIdNotFound() { @Test void setFRBRaliasCurrentVersionId() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + + + """ ) - .build(); + ); final UUID newCurrentVersion = UUID.randomUUID(); frbrExpression.setFRBRaliasCurrentVersionId(newCurrentVersion); @@ -172,21 +151,18 @@ void setFRBRaliasCurrentVersionId() { @Test void getFRBRaliasNextVersionId() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + + + """ ) - .build(); + ); assertThat(frbrExpression.getFRBRaliasNextVersionId().get().toString()) .hasToString("931577e5-66ba-48f5-a6eb-db40bcfd6b87"); @@ -194,41 +170,35 @@ void getFRBRaliasNextVersionId() { @Test void getFRBRaliasNextVersionIdNotFound() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + + """ ) - .build(); + ); assertThat(frbrExpression.getFRBRaliasNextVersionId()).isEmpty(); } @Test void setFRBRaliasNextVersionId() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + + + """ ) - .build(); + ); final UUID newNextVersion = UUID.randomUUID(); frbrExpression.setFRBRaliasNextVersionId(newNextVersion); @@ -238,21 +208,18 @@ void setFRBRaliasNextVersionId() { @Test void createsFRBRaliasNextVersionId() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - This would have to exist in a valid document and we need it to insert the next version ID in order - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + This would have to exist in a valid document and we need it to insert the next version ID in order + + """ ) - .build(); + ); final UUID newNextVersion = UUID.randomUUID(); frbrExpression.setFRBRaliasNextVersionId(newNextVersion); @@ -262,21 +229,18 @@ void createsFRBRaliasNextVersionId() { @Test void deleteAliasNextVersionId() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + + + """ ) - .build(); + ); frbrExpression.deleteAliasNextVersionId(); @@ -285,20 +249,17 @@ void deleteAliasNextVersionId() { @Test void deleteAliasNextVersionIdDoesNothing() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + + """ ) - .build(); + ); frbrExpression.deleteAliasNextVersionId(); @@ -307,21 +268,18 @@ void deleteAliasNextVersionIdDoesNothing() { @Test void getFRBRthisEli() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + + + """ ) - .build(); + ); assertThat(frbrExpression.getEli()) .hasToString("eli/bund/bgbl-1/1964/s593/1964-08-05/1/deu/regelungstext-1"); @@ -329,21 +287,18 @@ void getFRBRthisEli() { @Test void setFRBRthisEli() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + + + """ ) - .build(); + ); frbrExpression.setEli( ExpressionEli.fromString("eli/bund/bgbl-1/2025/1/2025-01-01/1/deu/regelungstext-1") @@ -355,42 +310,36 @@ void setFRBRthisEli() { @Test void getFBRDate() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + + + + """ ) - .build(); + ); assertThat(frbrExpression.getFBRDate()).isEqualTo("1964-08-05"); } @Test void getFBRDateNotFound() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + + """ ) - .build(); + ); assertThatThrownBy(frbrExpression::getFBRDate) .isInstanceOf(MandatoryNodeNotFoundException.class); @@ -398,22 +347,19 @@ void getFBRDateNotFound() { @Test void setFBRDate() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + + + + """ ) - .build(); + ); frbrExpression.setFBRDate("2002-02-02", "test"); @@ -422,46 +368,40 @@ void setFBRDate() { @Test void getFRBRVersionNumber() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + + + + + """ ) - .build(); + ); assertThat(frbrExpression.getFRBRVersionNumber()).contains(1); } @Test void setFRBRVersionNumber() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + + + + + + """ ) - .build(); + ); frbrExpression.setFRBRVersionNumber(2); @@ -477,7 +417,7 @@ void setFRBRAuthor() { """ ); - final FRBRExpression frbrExpression = FRBRExpression.builder().node(node).build(); + final FRBRExpression frbrExpression = new FRBRExpression(node); frbrExpression.setFRBRAuthor("recht.bund.de/institution/bundespraesident"); @@ -487,18 +427,15 @@ void setFRBRAuthor() { @Test void getFBRLanguage() { - final FRBRExpression frbrExpression = FRBRExpression - .builder() - .node( - XmlMapper.toNode( - """ - - - - """ - ) + final FRBRExpression frbrExpression = new FRBRExpression( + XmlMapper.toNode( + """ + + + + """ ) - .build(); + ); assertThat(frbrExpression.getFRBRlanguage()).contains("deu"); } diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/FRBRManifestationTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/FRBRManifestationTest.java index 86381aa32..085727f06 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/FRBRManifestationTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/FRBRManifestationTest.java @@ -13,21 +13,18 @@ class FRBRManifestationTest { @Test void getFRBRthisEli() { - final FRBRManifestation frbrManifestation = FRBRManifestation - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - """ - ) + final FRBRManifestation frbrManifestation = new FRBRManifestation( + XmlMapper.toNode( + """ + + + + + + + """ ) - .build(); + ); assertThat(frbrManifestation.getEli()) .hasToString("eli/bund/bgbl-1/1964/s593/1964-08-05/1/deu/2020-01-01/regelungstext-1.xml"); @@ -35,21 +32,18 @@ void getFRBRthisEli() { @Test void setFRBRthisEli() { - final FRBRManifestation frbrManifestation = FRBRManifestation - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - """ - ) + final FRBRManifestation frbrManifestation = new FRBRManifestation( + XmlMapper.toNode( + """ + + + + + + + """ ) - .build(); + ); frbrManifestation.setEli( ManifestationEli.fromString( @@ -63,22 +57,19 @@ void setFRBRthisEli() { @Test void getFRBRuri() { - final FRBRManifestation frbrManifestation = FRBRManifestation - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - """ - ) + final FRBRManifestation frbrManifestation = new FRBRManifestation( + XmlMapper.toNode( + """ + + + + + + + + """ ) - .build(); + ); assertThat(frbrManifestation.getURI()) .isEqualTo(URI.create("eli/bund/bgbl-1/1964/s593/1964-08-05/1/deu")); @@ -86,22 +77,19 @@ void getFRBRuri() { @Test void setFRBRuri() { - final FRBRManifestation frbrManifestation = FRBRManifestation - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - """ - ) + final FRBRManifestation frbrManifestation = new FRBRManifestation( + XmlMapper.toNode( + """ + + + + + + + + """ ) - .build(); + ); frbrManifestation.setURI(URI.create("eli/bund/bgbl-1/1964/s593/2024-02-02/1/deu")); @@ -111,42 +99,36 @@ void setFRBRuri() { @Test void getFBRDate() { - final FRBRManifestation frbrManifestation = FRBRManifestation - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - """ - ) + final FRBRManifestation frbrManifestation = new FRBRManifestation( + XmlMapper.toNode( + """ + + + + + + + + """ ) - .build(); + ); assertThat(frbrManifestation.getFBRDate()).isEqualTo("1964-08-05"); } @Test void getFBRDateNotFound() { - final FRBRManifestation frbrManifestation = FRBRManifestation - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - """ - ) + final FRBRManifestation frbrManifestation = new FRBRManifestation( + XmlMapper.toNode( + """ + + + + + + """ ) - .build(); + ); assertThatThrownBy(frbrManifestation::getFBRDate) .isInstanceOf(MandatoryNodeNotFoundException.class); @@ -154,22 +136,19 @@ void getFBRDateNotFound() { @Test void setFBRDate() { - final FRBRManifestation frbrManifestation = FRBRManifestation - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - """ - ) + final FRBRManifestation frbrManifestation = new FRBRManifestation( + XmlMapper.toNode( + """ + + + + + + + + """ ) - .build(); + ); frbrManifestation.setFBRDate("2002-02-02", "test"); diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/FRBRWorkTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/FRBRWorkTest.java index f5afb9f79..de853b407 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/FRBRWorkTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/FRBRWorkTest.java @@ -14,42 +14,36 @@ class FRBRWorkTest { @Test void getFRBRthisEli() { - final FRBRWork frbrWork = FRBRWork - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - """ - ) + final FRBRWork frbrWork = new FRBRWork( + XmlMapper.toNode( + """ + + + + + + + """ ) - .build(); + ); assertThat(frbrWork.getEli()).hasToString("eli/bund/bgbl-1/1964/s593/regelungstext-1"); } @Test void setFRBRthisEli() { - final FRBRWork frbrWork = FRBRWork - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - """ - ) + final FRBRWork frbrWork = new FRBRWork( + XmlMapper.toNode( + """ + + + + + + + """ ) - .build(); + ); frbrWork.setEli(WorkEli.fromString("eli/bund/bgbl-1/2025/1/regelungstext-1")); @@ -58,64 +52,55 @@ void setFRBRthisEli() { @Test void getFBRDate() { - final FRBRWork frbrWork = FRBRWork - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - """ - ) + final FRBRWork frbrWork = new FRBRWork( + XmlMapper.toNode( + """ + + + + + + + + """ ) - .build(); + ); assertThat(frbrWork.getFBRDate()).isEqualTo("1964-08-05"); } @Test void getFBRDateNotFound() { - final FRBRWork frbrWork = FRBRWork - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - """ - ) + final FRBRWork frbrWork = new FRBRWork( + XmlMapper.toNode( + """ + + + + + + """ ) - .build(); + ); assertThatThrownBy(frbrWork::getFBRDate).isInstanceOf(MandatoryNodeNotFoundException.class); } @Test void setFBRDate() { - final FRBRWork frbrWork = FRBRWork - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - """ - ) + final FRBRWork frbrWork = new FRBRWork( + XmlMapper.toNode( + """ + + + + + + + + """ ) - .build(); + ); frbrWork.setFBRDate("2002-02-02", "test"); @@ -124,96 +109,81 @@ void setFBRDate() { @Test void getFRBRname() { - final FRBRWork frbrWork = FRBRWork - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - """ - ) + final FRBRWork frbrWork = new FRBRWork( + XmlMapper.toNode( + """ + + + + + + """ ) - .build(); + ); assertThat(frbrWork.getFRBRname()).contains("BGBl. I"); } @Test void getFRBRnameEmpty() { - final FRBRWork frbrWork = FRBRWork - .builder() - .node( - XmlMapper.toNode( - """ - - - - - """ - ) + final FRBRWork frbrWork = new FRBRWork( + XmlMapper.toNode( + """ + + + + + """ ) - .build(); + ); assertThat(frbrWork.getFRBRname()).isEmpty(); } @Test void getFRBRnumber() { - final FRBRWork frbrWork = FRBRWork - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - """ - ) + final FRBRWork frbrWork = new FRBRWork( + XmlMapper.toNode( + """ + + + + + + """ ) - .build(); + ); assertThat(frbrWork.getFRBRnumber()).contains("s593"); } @Test void getFRBRnumberEmpty() { - final FRBRWork frbrWork = FRBRWork - .builder() - .node( - XmlMapper.toNode( - """ - - - - - """ - ) + final FRBRWork frbrWork = new FRBRWork( + XmlMapper.toNode( + """ + + + + + """ ) - .build(); + ); assertThat(frbrWork.getFRBRnumber()).isEmpty(); } @Test void setFRBRName() { - final FRBRWork frbrWork = FRBRWork - .builder() - .node( - XmlMapper.toNode( - """ - - - - """ - ) + final FRBRWork frbrWork = new FRBRWork( + XmlMapper.toNode( + """ + + + + """ ) - .build(); + ); frbrWork.setFRBRName("bgbl-2"); @@ -229,7 +199,7 @@ void setFRBRAuthor() { """ ); - final FRBRWork frbrWork = FRBRWork.builder().node(node).build(); + final FRBRWork frbrWork = new FRBRWork(node); frbrWork.setFRBRAuthor("recht.bund.de/institution/bundespraesident"); diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/LifecycleTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/LifecycleTest.java index 697cfdb46..bc5d0ede3 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/LifecycleTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/LifecycleTest.java @@ -10,19 +10,16 @@ class LifecycleTest { @Test void getEventRefEId() { // given - final Lifecycle lifecycle = Lifecycle - .builder() - .node( - XmlMapper.toNode( - """ - - - - - """ - ) + final Lifecycle lifecycle = new Lifecycle( + XmlMapper.toNode( + """ + + + + + """ ) - .build(); + ); // when var eventRefs = lifecycle.getEventRefs(); @@ -34,17 +31,14 @@ void getEventRefEId() { @Test void getEventRefEIdEmpty() { // given - final Lifecycle lifecycle = Lifecycle - .builder() - .node( - XmlMapper.toNode( - """ - - - """ - ) + final Lifecycle lifecycle = new Lifecycle( + XmlMapper.toNode( + """ + + + """ ) - .build(); + ); // when var eventRefs = lifecycle.getEventRefs(); diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/MetaTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/MetaTest.java index df8fc4275..e24f65d85 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/MetaTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/MetaTest.java @@ -15,100 +15,88 @@ class MetaTest { @Test void getFRBRExpression() { - final Meta meta = Meta - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - """ - ) + final Meta meta = new Meta( + XmlMapper.toNode( + """ + + + + + + + + + + + """ ) - .build(); + ); assertThat(meta.getFRBRExpression()).isNotNull(); } @Test void getFRBRExpressionNotFound() { - final Meta meta = Meta - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - """ - ) + final Meta meta = new Meta( + XmlMapper.toNode( + """ + + + + + + + + + + + """ ) - .build(); + ); assertThatThrownBy(meta::getFRBRExpression).isInstanceOf(MandatoryNodeNotFoundException.class); } @Test void getFRBRManifestation() { - final Meta meta = Meta - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - """ - ) + final Meta meta = new Meta( + XmlMapper.toNode( + """ + + + + + + + + + + + """ ) - .build(); + ); assertThat(meta.getFRBRManifestation()).isNotNull(); } @Test void getFRBRManifestationNotFound() { - final Meta meta = Meta - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - """ - ) + final Meta meta = new Meta( + XmlMapper.toNode( + """ + + + + + + + + + + + """ ) - .build(); + ); assertThatThrownBy(meta::getFRBRManifestation) .isInstanceOf(MandatoryNodeNotFoundException.class); @@ -116,127 +104,112 @@ void getFRBRManifestationNotFound() { @Test void getFRBRWork() { - final Meta meta = Meta - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - """ - ) + final Meta meta = new Meta( + XmlMapper.toNode( + """ + + + + + + + + + + + """ ) - .build(); + ); assertThat(meta.getFRBRWork()).isNotNull(); } @Test void getFRBRWorkNotFound() { - final Meta meta = Meta - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - """ - ) + final Meta meta = new Meta( + XmlMapper.toNode( + """ + + + + + + + + + + + """ ) - .build(); + ); assertThatThrownBy(meta::getFRBRWork).isInstanceOf(MandatoryNodeNotFoundException.class); } @Test void getTemporalData() { - final Meta meta = Meta - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - """ - ) + final Meta meta = new Meta( + XmlMapper.toNode( + """ + + + + + + + + + + + """ ) - .build(); + ); assertThat(meta.getTemporalData()).isNotNull(); } @Test void getTemporalDataNotFound() { - final Meta meta = Meta - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - """ - ) + final Meta meta = new Meta( + XmlMapper.toNode( + """ + + + + + + + + + + + """ ) - .build(); + ); assertThatThrownBy(meta::getTemporalData).isInstanceOf(MandatoryNodeNotFoundException.class); } @Test void getTemporalDataCreate() { - final Meta meta = Meta - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - """ - ) + final Meta meta = new Meta( + XmlMapper.toNode( + """ + + + + + + + + + + + """ ) - .build(); + ); assertThat(meta.getOrCreateTemporalData()).isNotNull(); assertThat(meta.getTemporalData()).isNotNull(); @@ -244,26 +217,23 @@ void getTemporalDataCreate() { @Test void getAnalysis() { - final Meta meta = Meta - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - - """ - ) + final Meta meta = new Meta( + XmlMapper.toNode( + """ + + + + + + + + + + + + """ ) - .build(); + ); final Optional analysis = meta.getAnalysis(); @@ -272,25 +242,22 @@ void getAnalysis() { @Test void getAnalysisEmpty() { - final Meta meta = Meta - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - """ - ) + final Meta meta = new Meta( + XmlMapper.toNode( + """ + + + + + + + + + + + """ ) - .build(); + ); final Optional analysis = meta.getAnalysis(); @@ -299,25 +266,22 @@ void getAnalysisEmpty() { @Test void getAnalysisCreate() { - final Meta meta = Meta - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - """ - ) + final Meta meta = new Meta( + XmlMapper.toNode( + """ + + + + + + + + + + + """ ) - .build(); + ); final Analysis analysis = meta.getOrCreateAnalysis(); @@ -327,26 +291,23 @@ void getAnalysisCreate() { @Test void insertsAnalysisInOrder() { - final Meta meta = Meta - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - - """ - ) + final Meta meta = new Meta( + XmlMapper.toNode( + """ + + + + + + + + + + + + """ ) - .build(); + ); meta.getOrCreateAnalysis(); final var children = NodeParser @@ -362,71 +323,62 @@ void insertsAnalysisInOrder() { @Test void getLifecycle() { - final Meta meta = Meta - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - """ - ) + final Meta meta = new Meta( + XmlMapper.toNode( + """ + + + + + + + """ ) - .build(); + ); assertThat(meta.getLifecycle()).isNotNull(); } @Test void getLifecycleNotFound() { - final Meta meta = Meta - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - """ - ) + final Meta meta = new Meta( + XmlMapper.toNode( + """ + + + + + + + + + + + """ ) - .build(); + ); assertThatThrownBy(meta::getLifecycle).isInstanceOf(MandatoryNodeNotFoundException.class); } @Test void getOrCreateLifecycle() { - final Meta meta = Meta - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - """ - ) + final Meta meta = new Meta( + XmlMapper.toNode( + """ + + + + + + + """ ) - .build(); + ); assertThat(meta.getOrCreateLifecycle()).isNotNull(); assertThat(((Element) meta.getOrCreateLifecycle().getNode()).getAttribute("GUID")) @@ -435,32 +387,29 @@ void getOrCreateLifecycle() { @Test void getOrCreateLifecycleMissingLifecycle() { - final Meta meta = Meta - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - - - - gesetz - 754-28-1 - verkuendungsfassung - - - - """ - ) + final Meta meta = new Meta( + XmlMapper.toNode( + """ + + + + + + + + + + + + gesetz + 754-28-1 + verkuendungsfassung + + + + """ ) - .build(); + ); assertThat(meta.getOrCreateLifecycle()).isNotNull(); assertThat(((Element) meta.getOrCreateLifecycle().getNode()).getAttribute("GUID")).isNotNull(); @@ -476,24 +425,21 @@ void getOrCreateLifecycleMissingLifecycle() { @Test void getOrCreateProprietary() { - final Meta meta = Meta - .builder() - .node( - XmlMapper.toNode( - """ - - - - gesetz - 754-28-1 - verkuendungsfassung - - - - """ - ) + final Meta meta = new Meta( + XmlMapper.toNode( + """ + + + + gesetz + 754-28-1 + verkuendungsfassung + + + + """ ) - .build(); + ); assertThat(meta.getOrCreateProprietary()).isNotNull(); } @@ -525,24 +471,21 @@ void returnsProprietaryEvenIfDoesNotExistInNorm() { @Test void returnsOptionalProprietaryIfItExists() { - final Meta meta = Meta - .builder() - .node( - XmlMapper.toNode( - """ - - - - gesetz - 754-28-1 - verkuendungsfassung - - - - """ - ) + final Meta meta = new Meta( + XmlMapper.toNode( + """ + + + + gesetz + 754-28-1 + verkuendungsfassung + + + + """ ) - .build(); + ); assertThat(meta.getProprietary()).isNotEmpty(); } diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/MetadatenBundTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/MetadatenBundTest.java index 0c6fc356e..cf0c335d0 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/MetadatenBundTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/MetadatenBundTest.java @@ -10,21 +10,18 @@ class MetadatenBundTest { @Test void getRessort() { - final MetadatenBund metadatenBund = MetadatenBund - .builder() - .node( - XmlMapper.toNode( - """ - - - Bundesministerium des Innern und für Heimat - Bundesministerium der Justiz - - - """ - ) + final MetadatenBund metadatenBund = new MetadatenBund( + XmlMapper.toNode( + """ + + + Bundesministerium des Innern und für Heimat + Bundesministerium der Justiz + + + """ ) - .build(); + ); assertThat( metadatenBund.getSimpleMetadatum( @@ -58,17 +55,14 @@ void getRessort() { @Test void getRessortNotPresent() { - final MetadatenBund metadatenBund = MetadatenBund - .builder() - .node( - XmlMapper.toNode( - """ - - - """ - ) + final MetadatenBund metadatenBund = new MetadatenBund( + XmlMapper.toNode( + """ + + + """ ) - .build(); + ); assertThat(metadatenBund.getSimpleMetadatum(MetadatenBund.Metadata.RESSORT, LocalDate.MAX)) .isEmpty(); @@ -76,21 +70,18 @@ void getRessortNotPresent() { @Test void setRessortUpdate() { - final MetadatenBund metadatenBund = MetadatenBund - .builder() - .node( - XmlMapper.toNode( - """ - - - Bundesministerium des Innern und für Heimat - Bundesministerium der Justiz - - - """ - ) + final MetadatenBund metadatenBund = new MetadatenBund( + XmlMapper.toNode( + """ + + + Bundesministerium des Innern und für Heimat + Bundesministerium der Justiz + + + """ ) - .build(); + ); final LocalDate atDate = LocalDate.parse("2002-10-01"); assertThat(metadatenBund.getSimpleMetadatum(MetadatenBund.Metadata.RESSORT, atDate)) @@ -106,21 +97,18 @@ void setRessortUpdate() { @Test void setRessortCreate() { - final MetadatenBund metadatenBund = MetadatenBund - .builder() - .node( - XmlMapper.toNode( - """ - - - Bundesministerium des Innern und für Heimat - Bundesministerium der Justiz - - - """ - ) + final MetadatenBund metadatenBund = new MetadatenBund( + XmlMapper.toNode( + """ + + + Bundesministerium des Innern und für Heimat + Bundesministerium der Justiz + + + """ ) - .build(); + ); final LocalDate atDate = LocalDate.parse("1990-01-01"); assertThat(metadatenBund.getSimpleMetadatum(MetadatenBund.Metadata.RESSORT, atDate)).isEmpty(); diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/MetadatenDeTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/MetadatenDeTest.java index 1c3e659e4..479854189 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/MetadatenDeTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/MetadatenDeTest.java @@ -9,53 +9,44 @@ class MetadatenDeTest { @Test void getFna() { - final MetadatenDe metadatenDe = MetadatenDe - .builder() - .node( - XmlMapper.toNode( - """ - - 111-11-1 - - """ - ) + final MetadatenDe metadatenDe = new MetadatenDe( + XmlMapper.toNode( + """ + + 111-11-1 + + """ ) - .build(); + ); assertThat(metadatenDe.getFna()).contains("111-11-1"); } @Test void getFnaEmpty() { - final MetadatenDe metadatenDe = MetadatenDe - .builder() - .node( - XmlMapper.toNode( - """ - - - """ - ) + final MetadatenDe metadatenDe = new MetadatenDe( + XmlMapper.toNode( + """ + + + """ ) - .build(); + ); assertThat(metadatenDe.getFna()).isEmpty(); } @Test void setFnaWhenFnaExists() { - final MetadatenDe metadatenDe = MetadatenDe - .builder() - .node( - XmlMapper.toNode( - """ - - 111-11-1 - - """ - ) + final MetadatenDe metadatenDe = new MetadatenDe( + XmlMapper.toNode( + """ + + 111-11-1 + + """ ) - .build(); + ); metadatenDe.setFna("222-22-2"); @@ -64,17 +55,14 @@ void setFnaWhenFnaExists() { @Test void setFnaWhenEmpty() { - final MetadatenDe metadatenDe = MetadatenDe - .builder() - .node( - XmlMapper.toNode( - """ - - - """ - ) + final MetadatenDe metadatenDe = new MetadatenDe( + XmlMapper.toNode( + """ + + + """ ) - .build(); + ); metadatenDe.setFna("222-22-2"); @@ -83,106 +71,88 @@ void setFnaWhenEmpty() { @Test void getArt() { - final MetadatenDe metadatenDe = MetadatenDe - .builder() - .node( - XmlMapper.toNode( - """ - - test art - - """ - ) + final MetadatenDe metadatenDe = new MetadatenDe( + XmlMapper.toNode( + """ + + test art + + """ ) - .build(); + ); assertThat(metadatenDe.getArt()).contains("test art"); } @Test void getArtEmpty() { - final MetadatenDe metadatenDe = MetadatenDe - .builder() - .node( - XmlMapper.toNode( - """ - - - """ - ) + final MetadatenDe metadatenDe = new MetadatenDe( + XmlMapper.toNode( + """ + + + """ ) - .build(); + ); assertThat(metadatenDe.getArt()).isEmpty(); } @Test void getTyp() { - final MetadatenDe metadatenDe = MetadatenDe - .builder() - .node( - XmlMapper.toNode( - """ - - typi1 - - """ - ) + final MetadatenDe metadatenDe = new MetadatenDe( + XmlMapper.toNode( + """ + + typi1 + + """ ) - .build(); + ); assertThat(metadatenDe.getTyp()).contains("typi1"); } @Test void getTypEmpty() { - final MetadatenDe metadatenDe = MetadatenDe - .builder() - .node( - XmlMapper.toNode( - """ - - - """ - ) + final MetadatenDe metadatenDe = new MetadatenDe( + XmlMapper.toNode( + """ + + + """ ) - .build(); + ); assertThat(metadatenDe.getTyp()).isEmpty(); } @Test void getGesta() { - final MetadatenDe metadatenDe = MetadatenDe - .builder() - .node( - XmlMapper.toNode( - """ - - nicht-vorhanden - - """ - ) + final MetadatenDe metadatenDe = new MetadatenDe( + XmlMapper.toNode( + """ + + nicht-vorhanden + + """ ) - .build(); + ); assertThat(metadatenDe.getGesta()).contains("nicht-vorhanden"); } @Test void setGestaWhenGestaExists() { - final MetadatenDe metadatenDe = MetadatenDe - .builder() - .node( - XmlMapper.toNode( - """ - - nicht-vorhanden - - """ - ) + final MetadatenDe metadatenDe = new MetadatenDe( + XmlMapper.toNode( + """ + + nicht-vorhanden + + """ ) - .build(); + ); metadatenDe.setGesta("a-gesta"); @@ -191,17 +161,14 @@ void setGestaWhenGestaExists() { @Test void setGestaWhenEmpty() { - final MetadatenDe metadatenDe = MetadatenDe - .builder() - .node( - XmlMapper.toNode( - """ - - - """ - ) + final MetadatenDe metadatenDe = new MetadatenDe( + XmlMapper.toNode( + """ + + + """ ) - .build(); + ); metadatenDe.setGesta("nicht-vorhanden"); @@ -210,36 +177,30 @@ void setGestaWhenEmpty() { @Test void getFassung() { - final MetadatenDe metadatenDe = MetadatenDe - .builder() - .node( - XmlMapper.toNode( - """ - - verkuendungsfassung - - """ - ) + final MetadatenDe metadatenDe = new MetadatenDe( + XmlMapper.toNode( + """ + + verkuendungsfassung + + """ ) - .build(); + ); assertThat(metadatenDe.getFassung()).contains("verkuendungsfassung"); } @Test void setFassungWhenFassungExists() { - final MetadatenDe metadatenDe = MetadatenDe - .builder() - .node( - XmlMapper.toNode( - """ - - verkuendungsfassung - - """ - ) + final MetadatenDe metadatenDe = new MetadatenDe( + XmlMapper.toNode( + """ + + verkuendungsfassung + + """ ) - .build(); + ); metadatenDe.setFassung("entwurfsfassung"); @@ -248,17 +209,14 @@ void setFassungWhenFassungExists() { @Test void setFassungWhenEmpty() { - final MetadatenDe metadatenDe = MetadatenDe - .builder() - .node( - XmlMapper.toNode( - """ - - - """ - ) + final MetadatenDe metadatenDe = new MetadatenDe( + XmlMapper.toNode( + """ + + + """ ) - .build(); + ); metadatenDe.setFassung("verkuendungsfassung"); diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/MetadatenDsTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/MetadatenDsTest.java index 6450f06c8..e53db31f2 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/MetadatenDsTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/MetadatenDsTest.java @@ -16,20 +16,17 @@ class getMetadatum { @Test void getFnaAtDate() { - final MetadatenDs metadatenDs = MetadatenDs - .builder() - .node( - XmlMapper.toNode( - """ - - 111-11-1 - 222-22-2 - 333-33-3 - - """ - ) - ) - .build(); + final MetadatenDs metadatenDs = new MetadatenDs( + XmlMapper.toNode( + """ + + 111-11-1 + 222-22-2 + 333-33-3 + + """ + ) + ); assertThat( metadatenDs.getSimpleMetadatum(MetadatenDs.Metadata.FNA, LocalDate.parse("1980-01-01")) @@ -78,20 +75,17 @@ class setMetadatum { @Test void setFnaAtDateUpdate() { - final MetadatenDs metadatenDs = MetadatenDs - .builder() - .node( - XmlMapper.toNode( - """ - - 111-11-1 - 222-22-2 - 333-33-3 - - """ - ) - ) - .build(); + final MetadatenDs metadatenDs = new MetadatenDs( + XmlMapper.toNode( + """ + + 111-11-1 + 222-22-2 + 333-33-3 + + """ + ) + ); final LocalDate newDate = LocalDate.parse("1990-01-01"); assertThat(metadatenDs.getNodes(MetadatenDs.Metadata.FNA.getXpath())).hasSize(3); @@ -107,17 +101,14 @@ void setFnaAtDateUpdate() { @Test void setFnaAtDateCreateWithUnbestimmtEnd() { - final MetadatenDs metadatenDs = MetadatenDs - .builder() - .node( - XmlMapper.toNode( - """ - - - """ - ) - ) - .build(); + final MetadatenDs metadatenDs = new MetadatenDs( + XmlMapper.toNode( + """ + + + """ + ) + ); final LocalDate newDate = LocalDate.parse("1980-01-01"); @@ -140,20 +131,17 @@ void setFnaAtDateCreateWithUnbestimmtEnd() { @Test void setFnaAtDateCreateWithEnd() { - final MetadatenDs metadatenDs = MetadatenDs - .builder() - .node( - XmlMapper.toNode( - """ - - 111-11-1 - 222-22-2 - 333-33-3 - - """ - ) - ) - .build(); + final MetadatenDs metadatenDs = new MetadatenDs( + XmlMapper.toNode( + """ + + 111-11-1 + 222-22-2 + 333-33-3 + + """ + ) + ); final LocalDate newDate = LocalDate.parse("1980-01-01"); assertThat(metadatenDs.getSimpleMetadatum(MetadatenDs.Metadata.FNA, newDate)).isEmpty(); @@ -175,20 +163,17 @@ void setFnaAtDateCreateWithEnd() { @Test void setFnaAtDateCreateAndUpdatePreviousUnbestimmtEnd() { - final MetadatenDs metadatenDs = MetadatenDs - .builder() - .node( - XmlMapper.toNode( - """ - - 111-11-1 - 222-22-2 - 333-33-3 - - """ - ) - ) - .build(); + final MetadatenDs metadatenDs = new MetadatenDs( + XmlMapper.toNode( + """ + + 111-11-1 + 222-22-2 + 333-33-3 + + """ + ) + ); final LocalDate newDate = LocalDate.parse("2005-01-01"); assertThat(metadatenDs.getSimpleMetadatum(MetadatenDs.Metadata.FNA, newDate)) @@ -221,18 +206,15 @@ void setFnaAtDateCreateAndUpdatePreviousUnbestimmtEnd() { @Test void setSubtypAtDateCreateAndSetDefaultWithEnd() { - final MetadatenDs metadatenDs = MetadatenDs - .builder() - .node( - XmlMapper.toNode( - """ - - subtyp0 - - """ - ) - ) - .build(); + final MetadatenDs metadatenDs = new MetadatenDs( + XmlMapper.toNode( + """ + + subtyp0 + + """ + ) + ); final LocalDate newDate = LocalDate.parse("2005-01-01"); assertThat(metadatenDs.getSimpleMetadatum(MetadatenDs.Metadata.SUBTYP, newDate)) @@ -258,20 +240,17 @@ void setSubtypAtDateCreateAndSetDefaultWithEnd() { @Test void removeNodeIfSetWithNull() { - final MetadatenDs metadatenDs = MetadatenDs - .builder() - .node( - XmlMapper.toNode( - """ - - 111-11-1 - 222-22-2 - 333-33-3 - - """ - ) - ) - .build(); + final MetadatenDs metadatenDs = new MetadatenDs( + XmlMapper.toNode( + """ + + 111-11-1 + 222-22-2 + 333-33-3 + + """ + ) + ); final LocalDate newDate = LocalDate.parse("1995-01-01"); assertThat(metadatenDs.getSimpleMetadatum(MetadatenDs.Metadata.FNA, newDate)) @@ -286,19 +265,16 @@ void removeNodeIfSetWithNull() { @Test void removeNothingIfNodeNotPresent() { - final MetadatenDs metadatenDs = MetadatenDs - .builder() - .node( - XmlMapper.toNode( - """ - - 111-11-1 - 333-33-3 - - """ - ) - ) - .build(); + final MetadatenDs metadatenDs = new MetadatenDs( + XmlMapper.toNode( + """ + + 111-11-1 + 333-33-3 + + """ + ) + ); final LocalDate newDate = LocalDate.parse("1995-01-01"); assertThat(metadatenDs.getSimpleMetadatum(MetadatenDs.Metadata.FNA, newDate)).isEmpty(); @@ -316,20 +292,17 @@ class Attributes { @Test void getAttributeAtDate() { - final MetadatenDs metadatenDs = MetadatenDs - .builder() - .node( - XmlMapper.toNode( - """ - - organ 1 - organ 2 - organ 3 - - """ - ) - ) - .build(); + final MetadatenDs metadatenDs = new MetadatenDs( + XmlMapper.toNode( + """ + + organ 1 + organ 2 + organ 3 + + """ + ) + ); assertThat( metadatenDs.getAttributeOfSimpleMetadatumAt( @@ -401,18 +374,15 @@ void getAttributeAtDate() { @Test void setAttributeAtDateUpdate() { - final MetadatenDs metadatenDs = MetadatenDs - .builder() - .node( - XmlMapper.toNode( - """ - - organ 1 - - """ - ) - ) - .build(); + final MetadatenDs metadatenDs = new MetadatenDs( + XmlMapper.toNode( + """ + + organ 1 + + """ + ) + ); final LocalDate newDate = LocalDate.parse("1990-01-01"); assertThat( @@ -440,18 +410,15 @@ void setAttributeAtDateUpdate() { @Test void setAttributeAtDateCreate() { - final MetadatenDs metadatenDs = MetadatenDs - .builder() - .node( - XmlMapper.toNode( - """ - - organ 1 - - """ - ) - ) - .build(); + final MetadatenDs metadatenDs = new MetadatenDs( + XmlMapper.toNode( + """ + + organ 1 + + """ + ) + ); final LocalDate newDate = LocalDate.parse("1990-01-01"); assertThat( @@ -479,19 +446,16 @@ void setAttributeAtDateCreate() { @Test void setAttributeAtDateParentNotPresent() { - final MetadatenDs metadatenDs = MetadatenDs - .builder() - .node( - XmlMapper.toNode( - """ - - organ 2 - organ 3 - - """ - ) - ) - .build(); + final MetadatenDs metadatenDs = new MetadatenDs( + XmlMapper.toNode( + """ + + organ 2 + organ 3 + + """ + ) + ); final LocalDate newDate = LocalDate.parse("1990-01-01"); assertThat( @@ -519,19 +483,16 @@ void setAttributeAtDateParentNotPresent() { @Test void removeAttributeAtValueNull() { - final MetadatenDs metadatenDs = MetadatenDs - .builder() - .node( - XmlMapper.toNode( - """ - - organ 2 - - - """ - ) - ) - .build(); + final MetadatenDs metadatenDs = new MetadatenDs( + XmlMapper.toNode( + """ + + organ 2 + + + """ + ) + ); final LocalDate newDate = LocalDate.parse("2002-01-01"); assertThat( @@ -566,22 +527,19 @@ class getMetadatenDsEinzelelement { @Test void getEinzelelementArtDerNormAtDate() { var eid = "hauptteil-1_abschnitt-0_art-1"; - final MetadatenDs metadatenDs = MetadatenDs - .builder() - .node( - XmlMapper.toNode( - """ - - - SN - ÄN - ÜN - - - """ - ) - ) - .build(); + final MetadatenDs metadatenDs = new MetadatenDs( + XmlMapper.toNode( + """ + + + SN + ÄN + ÜN + + + """ + ) + ); assertThat( metadatenDs.getSingleElementSimpleMetadatum( @@ -667,17 +625,14 @@ class updateMetadatenDsEinzelelement { @Test void createEinzelelementNode() { var eid = "hauptteil-1_abschnitt-0_art-1"; - final MetadatenDs metadatenDs = MetadatenDs - .builder() - .node( - XmlMapper.toNode( - """ - - - """ - ) - ) - .build(); + final MetadatenDs metadatenDs = new MetadatenDs( + XmlMapper.toNode( + """ + + + """ + ) + ); metadatenDs.updateSingleElementSimpleMetadatum( Einzelelement.Metadata.ART_DER_NORM, @@ -699,22 +654,19 @@ void createEinzelelementNode() { @Test void updateEinzelelementBetweenDates() { var eid = "hauptteil-1_abschnitt-0_art-1"; - final MetadatenDs metadatenDs = MetadatenDs - .builder() - .node( - XmlMapper.toNode( - """ - - - SN - ÄN - ÜN - - - """ - ) + final MetadatenDs metadatenDs = new MetadatenDs( + XmlMapper.toNode( + """ + + + SN + ÄN + ÜN + + + """ ) - .build(); + ); metadatenDs.updateSingleElementSimpleMetadatum( Einzelelement.Metadata.ART_DER_NORM, @@ -736,22 +688,19 @@ void updateEinzelelementBetweenDates() { @Test void updateEinzelelementAtStartDate() { var eid = "hauptteil-1_abschnitt-0_art-1"; - final MetadatenDs metadatenDs = MetadatenDs - .builder() - .node( - XmlMapper.toNode( - """ - - - SN - ÄN - ÜN - - - """ - ) + final MetadatenDs metadatenDs = new MetadatenDs( + XmlMapper.toNode( + """ + + + SN + ÄN + ÜN + + + """ ) - .build(); + ); metadatenDs.updateSingleElementSimpleMetadatum( Einzelelement.Metadata.ART_DER_NORM, @@ -773,22 +722,19 @@ void updateEinzelelementAtStartDate() { @Test void resetEinzelelementAtDate() { var eid = "hauptteil-1_abschnitt-0_art-1"; - final MetadatenDs metadatenDs = MetadatenDs - .builder() - .node( - XmlMapper.toNode( - """ - - - SN - ÄN - ÜN - - - """ - ) + final MetadatenDs metadatenDs = new MetadatenDs( + XmlMapper.toNode( + """ + + + SN + ÄN + ÜN + + + """ ) - .build(); + ); metadatenDs.updateSingleElementSimpleMetadatum( Einzelelement.Metadata.ART_DER_NORM, @@ -810,20 +756,17 @@ void resetEinzelelementAtDate() { @Test void resetLastEinzelelementAtDate() { var eid = "hauptteil-1_abschnitt-0_art-1"; - final MetadatenDs metadatenDs = MetadatenDs - .builder() - .node( - XmlMapper.toNode( - """ - - - SN - - - """ - ) + final MetadatenDs metadatenDs = new MetadatenDs( + XmlMapper.toNode( + """ + + + SN + + + """ ) - .build(); + ); metadatenDs.updateSingleElementSimpleMetadatum( Einzelelement.Metadata.ART_DER_NORM, diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/ModTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/ModTest.java index d918a370e..1ce1a6fcf 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/ModTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/ModTest.java @@ -65,10 +65,9 @@ class ModTest { @BeforeEach void setUp() { - quotedTextMod = Mod.builder().node(XmlMapper.toNode(QUOTED_TEXT_MOD)).build(); - quotedStructureRefMod = Mod.builder().node(XmlMapper.toNode(QUOTED_STRUCTURE_REF_MOD)).build(); - quotedStructureRrefMod = - Mod.builder().node(XmlMapper.toNode(QUOTED_STRUCTURE_RREF_MOD)).build(); + quotedTextMod = new Mod(XmlMapper.toNode(QUOTED_TEXT_MOD)); + quotedStructureRefMod = new Mod(XmlMapper.toNode(QUOTED_STRUCTURE_REF_MOD)); + quotedStructureRrefMod = new Mod(XmlMapper.toNode(QUOTED_STRUCTURE_RREF_MOD)); } @Test @@ -118,10 +117,7 @@ void setNewText() { ersetzt. """; - Mod quotedTextModWithRef = Mod - .builder() - .node(XmlMapper.toNode(QUOTED_TEXT_MOD_WITH_REF)) - .build(); + Mod quotedTextModWithRef = new Mod(XmlMapper.toNode(QUOTED_TEXT_MOD_WITH_REF)); // when quotedTextModWithRef.setNewText("new text"); var newText = quotedTextModWithRef.getNewText(); @@ -149,10 +145,7 @@ void setNewTextWithGuessedReference() { ersetzt. """; - Mod quotedTextModWithRef = Mod - .builder() - .node(XmlMapper.toNode(QUOTED_TEXT_MOD_WITH_REF)) - .build(); + Mod quotedTextModWithRef = new Mod(XmlMapper.toNode(QUOTED_TEXT_MOD_WITH_REF)); // when quotedTextModWithRef.setNewText("new text"); var newText = quotedTextModWithRef.getNewText(); @@ -294,29 +287,26 @@ void quotedTextDoesNotContainRef() { @Test void quotedTextContainsRef() { - final Mod mod = Mod - .builder() - .node( - XmlMapper.toNode( - """ - In § 20 Absatz 1 Satz 2 wird - die Angabe § 9 Abs. 1 Satz 2, Abs. 2 durch die - Wörter § 9 Absatz 1 Satz 2, Absatz 2 oder 3 - ersetzt. - """ - ) + final Mod mod = new Mod( + XmlMapper.toNode( + """ + In § 20 Absatz 1 Satz 2 wird + die Angabe § 9 Abs. 1 Satz 2, Abs. 2 durch die + Wörter § 9 Absatz 1 Satz 2, Absatz 2 oder 3 + ersetzt. + """ ) - .build(); + ); assertThat(mod.containsRef()).isTrue(); } @@ -328,26 +318,23 @@ void quotedStructureDoesNotContainRef() { @Test void quotedStructureContainsRef() { - final Mod mod = Mod - .builder() - .node( - XmlMapper.toNode( - """ - Der - Titel des Gesetzes wird ersetzt durch: - - - - Fiktives Beispielgesetz für das Ersetzen von Strukturen und Gliederungseinheiten mit Änderungsbefehlen - (Strukturänderungsgesetz) - - - - - """ - ) + final Mod mod = new Mod( + XmlMapper.toNode( + """ + Der + Titel des Gesetzes wird ersetzt durch: + + + + Fiktives Beispielgesetz für das Ersetzen von Strukturen und Gliederungseinheiten mit Änderungsbefehlen + (Strukturänderungsgesetz) + + + + + """ ) - .build(); + ); assertThat(mod.containsRef()).isTrue(); } @@ -360,7 +347,7 @@ void hasRref() { § 9 Absatz 1 bis 4 des Gesetzes wird ersetzt durch: """; - quotedStructureRefMod = Mod.builder().node(XmlMapper.toNode(rangeRefString)).build(); + quotedStructureRefMod = new Mod(XmlMapper.toNode(rangeRefString)); // when var result = quotedStructureRefMod.hasRref(); @@ -377,7 +364,7 @@ void hasRrefFalse() { Titel des Gesetzes wird ersetzt """; - quotedStructureRefMod = Mod.builder().node(XmlMapper.toNode(rangeRefString)).build(); + quotedStructureRefMod = new Mod(XmlMapper.toNode(rangeRefString)); // when var result = quotedStructureRefMod.hasRref(); diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/ProprietaryTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/ProprietaryTest.java index 91524a3be..379cb2f29 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/ProprietaryTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/ProprietaryTest.java @@ -14,91 +14,82 @@ class Fna { @Test void returnsTheFna() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - gesetz - 754-28-1 - verkuendungsfassung - - - """ - ) + gesetz + 754-28-1 + verkuendungsfassung + + + """ ) - .build(); + ); assertThat(proprietary.getFna()).contains("754-28-1"); } @Test void returnsEmptyOptionalIfFnaIsMissing() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - gesetz - stammform - verkuendungsfassung - - - """ - ) + gesetz + stammform + verkuendungsfassung + + + """ ) - .build(); + ); assertThat(proprietary.getFna()).isEmpty(); } @Test void returnsTheFnaAtDate() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - gesetz - 000-00-0 - verkuendungsfassung - - - 111-11-1 - 222-22-2 - 333-33-3 - - - """ - ) + gesetz + 000-00-0 + verkuendungsfassung + + + 111-11-1 + 222-22-2 + 333-33-3 + + + """ ) - .build(); + ); assertThat(proprietary.getFna(LocalDate.parse("1980-01-01"))).contains("000-00-0"); @@ -120,67 +111,58 @@ class MetadatenDs { @Test void returnsNode() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - - - - 111-11-1 - 222-22-2 - 333-33-3 - - - """ - ) + final Proprietary proprietary = new Proprietary( + XmlMapper.toNode( + """ + + + + 111-11-1 + 222-22-2 + 333-33-3 + + + """ ) - .build(); + ); assertThat(proprietary.getMetadatenDs()).isNotEmpty(); } @Test void returnsNodeEmpty() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - - - gesetz - 000-00-0 - verkuendungsfassung - - - """ - ) + final Proprietary proprietary = new Proprietary( + XmlMapper.toNode( + """ + + + gesetz + 000-00-0 + verkuendungsfassung + + + """ ) - .build(); + ); assertThat(proprietary.getMetadatenDs()).isEmpty(); } @Test void returnsNodeByCreatingIt() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - - - gesetz - 000-00-0 - verkuendungsfassung - - - """ - ) + final Proprietary proprietary = new Proprietary( + XmlMapper.toNode( + """ + + + gesetz + 000-00-0 + verkuendungsfassung + + + """ ) - .build(); + ); assertThat(proprietary.getOrCreateMetadatenDs()).isNotNull(); } @@ -191,27 +173,24 @@ class Art { @Test void returnsTheArt() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - rechtsetzungsdokument - - - """ - ) + rechtsetzungsdokument + + + """ ) - .build(); + ); assertThat(proprietary.getArt(LocalDate.parse("2010-10-10"))) .contains("rechtsetzungsdokument"); @@ -219,61 +198,55 @@ void returnsTheArt() { @Test void returnsEmptyOptionalIfArtIsMissing() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - - - - """ - ) + + + + """ ) - .build(); + ); assertThat(proprietary.getArt(LocalDate.parse("2010-10-10"))).isEmpty(); } @Test void returnsTheArtAtDate() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + + rechtsetzungsdokument + + - - rechtsetzungsdokument - - - regelungstext - begruendung - anschreiben - - - """ - ) + regelungstext + begruendung + anschreiben + + + """ ) - .build(); + ); assertThat(proprietary.getArt(LocalDate.parse("1980-01-01"))) .contains("rechtsetzungsdokument"); @@ -296,27 +269,24 @@ class Typ { @Test void returnsTheTyp() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - rechtsetzungsdokument - - - """ - ) + rechtsetzungsdokument + + + """ ) - .build(); + ); assertThat(proprietary.getTyp(LocalDate.parse("2010-10-10"))) .contains("rechtsetzungsdokument"); @@ -324,61 +294,55 @@ void returnsTheTyp() { @Test void returnsEmptyOptionalIfTypIsMissing() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - - - - """ - ) + + + + """ ) - .build(); + ); assertThat(proprietary.getTyp(LocalDate.parse("2010-10-10"))).isEmpty(); } @Test void returnsTheTypAtDate() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + + gesetz + + - - gesetz - - - verordnung - begruendung - satzung - - - """ - ) + verordnung + begruendung + satzung + + + """ ) - .build(); + ); assertThat(proprietary.getTyp(LocalDate.parse("1980-01-01"))).contains("gesetz"); @@ -400,27 +364,24 @@ class Subtyp { @Test void returnsTheSubtyp() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - Anordnung des Bundespräsidenten - - - """ - ) + Anordnung des Bundespräsidenten + + + """ ) - .build(); + ); assertThat(proprietary.getSubtyp(LocalDate.parse("2010-10-10"))) .contains("Anordnung des Bundespräsidenten"); @@ -428,57 +389,51 @@ void returnsTheSubtyp() { @Test void returnsEmptyOptionalIfSubtypIsMissing() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - - - - """ - ) + + + + """ ) - .build(); + ); assertThat(proprietary.getSubtyp(LocalDate.parse("2010-10-10"))).isEmpty(); } @Test void returnsTheSubtypAtDate() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - Anordnung des Bundespräsidenten - Bekanntmachung vor einer Neufassung - Völkerrechtliche Vereinbarung - Geschäftsordnung - - - """ - ) + Anordnung des Bundespräsidenten + Bekanntmachung vor einer Neufassung + Völkerrechtliche Vereinbarung + Geschäftsordnung + + + """ ) - .build(); + ); assertThat(proprietary.getSubtyp(LocalDate.parse("1980-01-01"))) .contains("Anordnung des Bundespräsidenten"); @@ -507,27 +462,24 @@ class BezeichnungInVorlage { @Test void returnsTheBezeichnungInVorlage() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - Bezeichnung gemäß Vorlage - - - """ - ) + Bezeichnung gemäß Vorlage + + + """ ) - .build(); + ); assertThat(proprietary.getBezeichnungInVorlage(LocalDate.parse("2010-10-10"))) .contains("Bezeichnung gemäß Vorlage"); @@ -535,57 +487,51 @@ void returnsTheBezeichnungInVorlage() { @Test void returnsEmptyOptionalIfBezeichnungInVorlageIsMissing() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - - - - """ - ) + + + + """ ) - .build(); + ); assertThat(proprietary.getBezeichnungInVorlage(LocalDate.parse("2010-10-10"))).isEmpty(); } @Test void returnsTheBezeichnungInVorlageAtDate() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - Bezeichnung gemäß Vorlage 1 - Bezeichnung gemäß Vorlage 2 - Bezeichnung gemäß Vorlage 3 - Bezeichnung gemäß Vorlage 4 - - - """ - ) + Bezeichnung gemäß Vorlage 1 + Bezeichnung gemäß Vorlage 2 + Bezeichnung gemäß Vorlage 3 + Bezeichnung gemäß Vorlage 4 + + + """ ) - .build(); + ); assertThat(proprietary.getBezeichnungInVorlage(LocalDate.parse("1980-01-01"))) .contains("Bezeichnung gemäß Vorlage 1"); @@ -616,84 +562,75 @@ class ArtDerNorm { @Test void returnsArtDerNorm() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - SN,ÄN,ÜN - - - """ - ) + SN,ÄN,ÜN + + + """ ) - .build(); + ); assertThat(proprietary.getArtDerNorm(LocalDate.parse("2010-10-10"))).contains("SN,ÄN,ÜN"); } @Test void returnsEmptyOptionalIfArtDerNormIsMissing() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - - - - """ - ) + + + + """ ) - .build(); + ); assertThat(proprietary.getArtDerNorm(LocalDate.parse("2010-10-10"))).isEmpty(); } @Test void returnsTheArtDerNormAtDate() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - SN,ÄN,ÜN - SN,ÄN - SN,ÜN - ÄN,ÜN - - - """ - ) + SN,ÄN,ÜN + SN,ÄN + SN,ÜN + ÄN,ÜN + + + """ ) - .build(); + ); assertThat(proprietary.getArtDerNorm(LocalDate.parse("1980-01-01"))).contains("SN,ÄN,ÜN"); @@ -715,84 +652,75 @@ class Staat { @Test void returnsStaat() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - DEU - - - """ - ) + DEU + + + """ ) - .build(); + ); assertThat(proprietary.getStaat(LocalDate.parse("2010-10-10"))).contains("DEU"); } @Test void returnsEmptyOptionalIfStaatIsMissing() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - - - - """ - ) + + + + """ ) - .build(); + ); assertThat(proprietary.getStaat(LocalDate.parse("2010-10-10"))).isEmpty(); } @Test void returnsTheStaatAtDate() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - DEU - DDR - BW - BY - - - """ - ) + DEU + DDR + BW + BY + + + """ ) - .build(); + ); assertThat(proprietary.getStaat(LocalDate.parse("1980-01-01"))).contains("DEU"); @@ -814,27 +742,24 @@ class BeschliessendesOrgan { @Test void returnsBeschliessendesOrgan() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - Bundestag - - - """ - ) + Bundestag + + + """ ) - .build(); + ); assertThat(proprietary.getBeschliessendesOrgan(LocalDate.parse("2010-10-10"))) .contains("Bundestag"); @@ -844,27 +769,24 @@ void returnsBeschliessendesOrgan() { @Test void returnsEmptyOptionalIfBeschliessendesOrganIsMissing() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - - - - """ - ) + + + + """ ) - .build(); + ); assertThat(proprietary.getBeschliessendesOrgan(LocalDate.parse("2010-10-10"))).isEmpty(); assertThat(proprietary.getQualifizierteMehrheit(LocalDate.parse("2010-10-10"))).isEmpty(); @@ -872,30 +794,27 @@ void returnsEmptyOptionalIfBeschliessendesOrganIsMissing() { @Test void returnsTheBeschliessendesOrganAtDate() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - Bundestag 1 - Bundestag 2 - Bundestag 3 - Bundestag 4 - - - """ - ) + Bundestag 1 + Bundestag 2 + Bundestag 3 + Bundestag 4 + + + """ ) - .build(); + ); assertThat(proprietary.getBeschliessendesOrgan(LocalDate.parse("1980-01-01"))) .contains("Bundestag 1"); @@ -922,30 +841,27 @@ void returnsTheBeschliessendesOrganAtDate() { @Test void returnsTheBeschliessendesOrganQualifizierteMehrheitAtDate() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - Bundestag 1 - Bundestag 2 - Bundestag 3 - Bundestag 4 - - - """ - ) + Bundestag 1 + Bundestag 2 + Bundestag 3 + Bundestag 4 + + + """ ) - .build(); + ); assertThat(proprietary.getQualifizierteMehrheit(LocalDate.parse("1980-01-01"))) .contains(true); @@ -976,27 +892,24 @@ class OrganisationsEinheit { @Test void returnsOrganisationsEinheit() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - Organisationseinheit 1 - - - """ - ) + Organisationseinheit 1 + + + """ ) - .build(); + ); assertThat(proprietary.getOrganisationsEinheit(LocalDate.parse("2010-10-10"))) .contains("Organisationseinheit 1"); @@ -1004,57 +917,51 @@ void returnsOrganisationsEinheit() { @Test void returnsEmptyOptionalIfOrganisationsEinheitIsMissing() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - - - - """ - ) + + + + """ ) - .build(); + ); assertThat(proprietary.getOrganisationsEinheit(LocalDate.parse("2010-10-10"))).isEmpty(); } @Test void returnsTheOrganisationsEinheitAtDate() { - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - Organisationseinheit 1 - Organisationseinheit 2 - Organisationseinheit 3 - Organisationseinheit 4 - - - """ - ) + Organisationseinheit 1 + Organisationseinheit 2 + Organisationseinheit 3 + Organisationseinheit 4 + + + """ ) - .build(); + ); assertThat(proprietary.getOrganisationsEinheit(LocalDate.parse("1980-01-01"))) .contains("Organisationseinheit 1"); @@ -1086,30 +993,27 @@ class EinzelelementArtDerNorm { @Test void returnsEinzelelementArtDerNorm() { var eid = "hauptteil-1_abschnitt-0_art-1"; - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - SN,ÄN,ÜN - - ÜN - - - - """ - ) + SN,ÄN,ÜN + + ÜN + + + + """ ) - .build(); + ); assertThat(proprietary.getArtDerNorm(LocalDate.parse("2010-10-10"), eid)).contains("ÜN"); } @@ -1117,27 +1021,24 @@ void returnsEinzelelementArtDerNorm() { @Test void returnsEmptyOptionalIfEinzelelementArtDerNormIsMissing() { var eid = "hauptteil-1_abschnitt-0_art-1"; - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - - - - """ - ) + + + + """ ) - .build(); + ); assertThat(proprietary.getArtDerNorm(LocalDate.parse("2010-10-10"), eid)).isEmpty(); } @@ -1145,36 +1046,33 @@ void returnsEmptyOptionalIfEinzelelementArtDerNormIsMissing() { @Test void returnsTheEinzelelementArtDerNormAtDate() { var eid = "hauptteil-1_abschnitt-0_art-1"; - final Proprietary proprietary = Proprietary - .builder() - .node( - XmlMapper.toNode( - """ - + - - SN,ÄN,ÜN - SN,ÄN - SN,ÜN - ÄN,ÜN - - ÜN - SN - ÄN - ÜN - - - - """ - ) + SN,ÄN,ÜN + SN,ÄN + SN,ÜN + ÄN,ÜN + + ÜN + SN + ÄN + ÜN + + + + """ ) - .build(); + ); assertThat(proprietary.getArtDerNorm(LocalDate.parse("1980-01-01"), eid)).contains("ÜN"); diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/SimpleProprietaryTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/SimpleProprietaryTest.java index 0a3b0a446..fb4d26c75 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/SimpleProprietaryTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/SimpleProprietaryTest.java @@ -10,96 +10,78 @@ class SimpleProprietaryTest { @Test void getValue() { - final SimpleProprietary fna = SimpleProprietary - .builder() - .node( - XmlMapper.toNode( - """ - 111-11-1 - """ - ) + final SimpleProprietary fna = new SimpleProprietary( + XmlMapper.toNode( + """ + 111-11-1 + """ ) - .build(); + ); assertThat(fna.getValue()).isEqualTo("111-11-1"); } @Test void getValueNull() { - final SimpleProprietary fna = SimpleProprietary - .builder() - .node( - XmlMapper.toNode( - """ - - """ - ) + final SimpleProprietary fna = new SimpleProprietary( + XmlMapper.toNode( + """ + + """ ) - .build(); + ); assertThat(fna.getValue()).isEmpty(); } @Test void getStart() { - final SimpleProprietary fna = SimpleProprietary - .builder() - .node( - XmlMapper.toNode( - """ - 111-11-1 - """ - ) + final SimpleProprietary fna = new SimpleProprietary( + XmlMapper.toNode( + """ + 111-11-1 + """ ) - .build(); + ); assertThat(fna.getStart()).contains(LocalDate.parse("1990-01-01")); } @Test void getStartEmpty() { - final SimpleProprietary fna = SimpleProprietary - .builder() - .node( - XmlMapper.toNode( - """ - 111-11-1 - """ - ) + final SimpleProprietary fna = new SimpleProprietary( + XmlMapper.toNode( + """ + 111-11-1 + """ ) - .build(); + ); assertThat(fna.getStart()).isEmpty(); } @Test void getEnd() { - final SimpleProprietary fna = SimpleProprietary - .builder() - .node( - XmlMapper.toNode( - """ - 111-11-1 - """ - ) + final SimpleProprietary fna = new SimpleProprietary( + XmlMapper.toNode( + """ + 111-11-1 + """ ) - .build(); + ); assertThat(fna.getEnd()).contains(LocalDate.parse("1994-12-31")); } @Test void getEndEmpty() { - final SimpleProprietary fna = SimpleProprietary - .builder() - .node( - XmlMapper.toNode( - """ - 111-11-1 - """ - ) + final SimpleProprietary fna = new SimpleProprietary( + XmlMapper.toNode( + """ + 111-11-1 + """ ) - .build(); + ); assertThat(fna.getEnd()).isEmpty(); } diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/TemporalDataTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/TemporalDataTest.java index 3c6cc6b0c..a316b7564 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/TemporalDataTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/TemporalDataTest.java @@ -10,25 +10,22 @@ class TemporalDataTest { @Test void getTemporalGroups() { // given - final TemporalData temporalData = TemporalData - .builder() - .node( - XmlMapper.toNode( - """ - - - - - - - - - """ - ) + final TemporalData temporalData = new TemporalData( + XmlMapper.toNode( + """ + + + + + + + + + """ ) - .build(); + ); assertThat(temporalData.getTemporalGroups()).hasSize(2); } @@ -36,17 +33,14 @@ void getTemporalGroups() { @Test void getTemporalGroupsEmptyList() { // given - final TemporalData temporalData = TemporalData - .builder() - .node( - XmlMapper.toNode( - """ - - - """ - ) + final TemporalData temporalData = new TemporalData( + XmlMapper.toNode( + """ + + + """ ) - .build(); + ); assertThat(temporalData.getTemporalGroups()).isEmpty(); } diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/TemporalGroupTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/TemporalGroupTest.java index 79a02eed1..70dc07c26 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/TemporalGroupTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/TemporalGroupTest.java @@ -10,18 +10,15 @@ class TemporalGroupTest { @Test void getEid() { // given - TemporalGroup temporalGroup = TemporalGroup - .builder() - .node( - XmlMapper.toNode( - """ - - - - """ - ) + TemporalGroup temporalGroup = new TemporalGroup( + XmlMapper.toNode( + """ + + + + """ ) - .build(); + ); // when var eid = temporalGroup.getEid(); @@ -33,18 +30,15 @@ void getEid() { @Test void getEventRefEId() { // given - TemporalGroup temporalGroup = TemporalGroup - .builder() - .node( - XmlMapper.toNode( - """ - - - - """ - ) + TemporalGroup temporalGroup = new TemporalGroup( + XmlMapper.toNode( + """ + + + + """ ) - .build(); + ); // when var timeInterval = temporalGroup.getTimeInterval(); @@ -56,17 +50,14 @@ void getEventRefEId() { @Test void create() { // given - final TemporalData temporalData = TemporalData - .builder() - .node( - XmlMapper.toNode( - """ - - - """ - ) + final TemporalData temporalData = new TemporalData( + XmlMapper.toNode( + """ + + + """ ) - .build(); + ); // when var temporalGroup = temporalData.addTemporalGroup(); diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/TextualModTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/TextualModTest.java index ee1233c1e..c8add5301 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/TextualModTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/TextualModTest.java @@ -30,7 +30,7 @@ class TextualModTest { @BeforeEach void setUp() { - textualMod = TextualMod.builder().node(XmlMapper.toNode(COMMON_XML)).build(); + textualMod = new TextualMod(XmlMapper.toNode(COMMON_XML)); } @Test diff --git a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/TimeIntervalTest.java b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/TimeIntervalTest.java index 7c2a5d6b3..8c543c7c0 100644 --- a/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/TimeIntervalTest.java +++ b/backend/src/test/java/de/bund/digitalservice/ris/norms/domain/entity/TimeIntervalTest.java @@ -10,16 +10,13 @@ class TimeIntervalTest { @Test void getEventRefEId() { // given - final TimeInterval timeInterval = TimeInterval - .builder() - .node( - XmlMapper.toNode( - """ - - """ - ) + final TimeInterval timeInterval = new TimeInterval( + XmlMapper.toNode( + """ + + """ ) - .build(); + ); assertThat(timeInterval.getEventRefEId()).contains("meta-1_lebzykl-1_ereignis-2"); } @@ -27,16 +24,13 @@ void getEventRefEId() { @Test void getEventRefEIdEmpty() { // given - final TimeInterval timeInterval = TimeInterval - .builder() - .node( - XmlMapper.toNode( - """ - - """ - ) + final TimeInterval timeInterval = new TimeInterval( + XmlMapper.toNode( + """ + + """ ) - .build(); + ); assertThat(timeInterval.getEventRefEId()).isEmpty(); } @@ -44,17 +38,14 @@ void getEventRefEIdEmpty() { @Test void create() { // given - TemporalGroup temporalGroup = TemporalGroup - .builder() - .node( - XmlMapper.toNode( - """ - - - """ - ) + TemporalGroup temporalGroup = new TemporalGroup( + XmlMapper.toNode( + """ + + + """ ) - .build(); + ); // when var timeInterval = TimeInterval.createAndAppend(temporalGroup.getNode());