generated from digitalservicebund/java-application-template
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Superior Courts dont get location transformed
RISDEV-2846
- Loading branch information
Showing
2 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
backend/src/test/java/de/bund/digitalservice/ris/caselaw/adapter/CourtTransformerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package de.bund.digitalservice.ris.caselaw.adapter; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import de.bund.digitalservice.ris.caselaw.adapter.database.jpa.CourtDTO; | ||
import de.bund.digitalservice.ris.caselaw.adapter.transformer.CourtTransformer; | ||
import de.bund.digitalservice.ris.caselaw.domain.court.Court; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.CsvSource; | ||
|
||
class CourtTransformerTest { | ||
|
||
@ParameterizedTest | ||
@CsvSource({ | ||
"Bonn, NonSuperiorNonForeignCourt, false, false", | ||
"London, NonSuperiorForeignCourt, false, true" | ||
}) | ||
void shouldTransformLocation( | ||
String location, String type, boolean isSuperiorCourt, boolean isForeignCourt) { | ||
CourtDTO courtDTO = | ||
CourtDTO.builder() | ||
.jurisId(1) | ||
.type(type) | ||
.location(location) | ||
.isSuperiorCourt(isSuperiorCourt) | ||
.isForeignCourt(isForeignCourt) | ||
.build(); | ||
|
||
Court court = CourtTransformer.transformToDomain(courtDTO); | ||
|
||
// Assertion | ||
assertThat(court) | ||
.extracting("type", "location", "label") | ||
.containsExactly(type, location, type + " " + location); | ||
} | ||
|
||
@ParameterizedTest | ||
@CsvSource({ | ||
"BGH, SuperiorNonForeignCourt, true, false", | ||
"DenHaag, SuperiorForeignCourt, true, true" | ||
}) | ||
void shouldNotTransformLocation( | ||
String location, String type, boolean isSuperiorCourt, boolean isForeignCourt) { | ||
CourtDTO courtDTO = | ||
CourtDTO.builder() | ||
.jurisId(1) | ||
.type(type) | ||
.location(location) | ||
.isSuperiorCourt(isSuperiorCourt) | ||
.isForeignCourt(isForeignCourt) | ||
.build(); | ||
|
||
Court court = CourtTransformer.transformToDomain(courtDTO); | ||
assertThat(court).extracting("type", "location", "label").containsExactly(type, null, type); | ||
} | ||
} |