Skip to content

Commit

Permalink
Revert "refactor: multiple refacs in ConditionMapperTest (#142)"
Browse files Browse the repository at this point in the history
This reverts commit 84abcfe.
  • Loading branch information
chgl authored Oct 28, 2024
1 parent 84abcfe commit 2c8d358
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@
import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationModule;
import de.basisdatensatz.obds.v3.OBDS;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.TimeZone;
import org.approvaltests.Approvals;
import org.approvaltests.core.Options;
import org.hl7.fhir.r4.model.Reference;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.api.Test;
import org.miracum.streams.ume.obdstofhir.FhirProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
Expand All @@ -24,25 +21,23 @@
@SpringBootTest(classes = {FhirProperties.class})
@EnableConfigurationProperties
class ConditionMapperTest {
private final ConditionMapper sut;

private static ConditionMapper sut;

@BeforeAll
static void beforeEach(@Autowired FhirProperties fhirProps) {
TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin"));
@Autowired
ConditionMapperTest(FhirProperties fhirProps) {
sut = new ConditionMapper(fhirProps);
}

@ParameterizedTest
@CsvSource({"obds3/test1.xml"})
void map_withGivenObds_shouldCreateValidConditionResource(String sourceFile) throws IOException {
final var resource = this.getClass().getClassLoader().getResource(sourceFile);
@Test
void map_withGivenObds_shouldCreateValidConditionResource() throws IOException {
TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin"));
// TODO: refactor to use a data provider for parameterized tests
final var resource = this.getClass().getClassLoader().getResource("obds3/test1.xml");
assertThat(resource).isNotNull();

final var xmlMapper =
XmlMapper.builder()
.defaultUseWrapper(false)
.defaultDateFormat(new SimpleDateFormat("yyyy-MM-dd"))
.addModule(new JakartaXmlBindAnnotationModule())
.addModule(new Jdk8Module())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"subject": {
"reference": "Patient/1"
},
"recordedDate": "2024-06-10T00:00:00+02:00"
"recordedDate": "2024-06-10T02:00:00+02:00"
}

0 comments on commit 2c8d358

Please sign in to comment.