-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: return timespan of all partial radiations
fixes #79
- Loading branch information
Showing
2 changed files
with
75 additions
and
25 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
48 changes: 48 additions & 0 deletions
48
src/test/java/org/miracum/streams/ume/obdstofhir/mapper/ObdsProcedureMapperTest.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,48 @@ | ||
package org.miracum.streams.ume.obdstofhir.mapper; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.time.Instant; | ||
import java.util.Date; | ||
import java.util.List; | ||
import lombok.val; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.miracum.streams.ume.obdstofhir.FhirProperties; | ||
import org.miracum.streams.ume.obdstofhir.model.ADT_GEKID.Menge_Patient.Patient.Menge_Meldung.Meldung.Menge_ST.ST.Menge_Bestrahlung.Bestrahlung; | ||
import org.miracum.streams.ume.obdstofhir.model.Tupel; | ||
|
||
public class ObdsProcedureMapperTest { | ||
|
||
private ObdsProcedureMapper mapper; | ||
|
||
@BeforeEach | ||
void setup() { | ||
this.mapper = new ObdsProcedureMapper(new FhirProperties()); | ||
} | ||
|
||
@Test | ||
void shouldGetWholeTimeSpanFromPartialRadiations() { | ||
val partialRadiations = | ||
List.of( | ||
getTestPartialRadiationForTimespand("01.01.2024", "31.01.2024"), | ||
getTestPartialRadiationForTimespand("01.03.2024", "30.04.2024"), | ||
getTestPartialRadiationForTimespand("10.05.2024", "31.05.2024")); | ||
|
||
val actual = this.mapper.getTimeSpanFromPartialRadiations(partialRadiations); | ||
|
||
assertThat(actual) | ||
.isEqualTo( | ||
Tupel.builder() | ||
.first(Date.from(Instant.parse("2024-01-01T00:00:00Z"))) | ||
.second(Date.from(Instant.parse("2024-05-31T00:00:00Z"))) | ||
.build()); | ||
} | ||
|
||
private static Bestrahlung getTestPartialRadiationForTimespand(String start, String end) { | ||
Bestrahlung bestrahlung = new Bestrahlung(); | ||
bestrahlung.setST_Beginn_Datum(start); | ||
bestrahlung.setST_Ende_Datum(end); | ||
return bestrahlung; | ||
} | ||
} |