-
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.
feat: add configuration for patient id pattern
- Loading branch information
Showing
3 changed files
with
63 additions
and
2 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
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
49 changes: 49 additions & 0 deletions
49
src/test/java/org/miracum/streams/ume/obdstofhir/mapper/ObdsToFhirIntegrationTest.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,49 @@ | ||
package org.miracum.streams.ume.obdstofhir.mapper; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.junit.jupiter.api.Nested; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.CsvSource; | ||
import org.miracum.streams.ume.obdstofhir.FhirProperties; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.mock.mockito.MockBean; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.test.context.TestPropertySource; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
|
||
@ExtendWith(SpringExtension.class) | ||
@Import({ObdsTestMapper.class}) | ||
@MockBean(FhirProperties.class) | ||
public class ObdsToFhirIntegrationTest { | ||
|
||
@Autowired ObdsTestMapper mapper; | ||
|
||
@Nested | ||
@TestPropertySource(properties = {"app.localPatientIdPattern=\\\\w*"}) | ||
class AllWordCharactersAllowed { | ||
|
||
@ParameterizedTest | ||
@CsvSource({ | ||
"12345,12345", | ||
"123456789,123456789", | ||
"1234567890,1234567890", | ||
"1234567891,1234567891", | ||
"0000012345,0000012345" | ||
}) | ||
void keepPatientIdWithLocalPatientIdPattern(String input, String output) { | ||
var actual = ObdsToFhirMapper.convertId(input); | ||
assertThat(actual).isEqualTo(output); | ||
} | ||
} | ||
} | ||
|
||
@Component | ||
class ObdsTestMapper extends ObdsToFhirMapper { | ||
|
||
protected ObdsTestMapper(FhirProperties fhirProperties) { | ||
super(fhirProperties); | ||
} | ||
} |