summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul-Christian Volkmer2026-06-18 09:30:46 +0200
committerPaul-Christian Volkmer2026-06-18 09:30:46 +0200
commitd0fc0ed8eff036c0c01247e638625cdfef118efd (patch)
tree0c73479bd89ed37aec89dfe5b7822d51ba7e8656 /src
parent3857d43edcb17ca63e81bdd143427d8a2749d958 (diff)
test: move test method and remove obsolete test class
Diffstat (limited to 'src')
-rw-r--r--src/test/kotlin/dev/dnpm/etl/processor/consent/ConsentProcessorTest.kt80
-rw-r--r--src/test/kotlin/dev/dnpm/etl/processor/services/ConsentProcessorTest.kt19
2 files changed, 19 insertions, 80 deletions
diff --git a/src/test/kotlin/dev/dnpm/etl/processor/consent/ConsentProcessorTest.kt b/src/test/kotlin/dev/dnpm/etl/processor/consent/ConsentProcessorTest.kt
deleted file mode 100644
index 30e3823..0000000
--- a/src/test/kotlin/dev/dnpm/etl/processor/consent/ConsentProcessorTest.kt
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * This file is part of ETL-Processor
- *
- * Copyright (c) 2023 Comprehensive Cancer Center Mainfranken
- * Copyright (c) 2026 Paul-Christian Volkmer, Datenintegrationszentrum Philipps-Universität Marburg and Contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package dev.dnpm.etl.processor.consent
-
-import ca.uhn.fhir.context.FhirContext
-import dev.dnpm.etl.processor.config.AppConfigProperties
-import dev.dnpm.etl.processor.config.GIcsConfigProperties
-import dev.dnpm.etl.processor.services.ConsentProcessor
-import org.assertj.core.api.Assertions.assertThat
-import org.hl7.fhir.r4.model.Bundle
-import org.hl7.fhir.r4.model.Consent
-import org.junit.jupiter.api.BeforeEach
-import org.junit.jupiter.api.extension.ExtendWith
-import org.junit.jupiter.params.ParameterizedTest
-import org.junit.jupiter.params.provider.CsvSource
-import org.mockito.Mock
-import org.mockito.junit.jupiter.MockitoExtension
-import tools.jackson.databind.json.JsonMapper
-import java.util.*
-
-@ExtendWith(MockitoExtension::class)
-class ConsentProcessorTest {
-
- lateinit var consentProcessor: ConsentProcessor
-
- val jsonMapper = JsonMapper()
- val fhirContext = FhirContext.forR4()
-
- @BeforeEach
- fun setup(@Mock consentService: IConsentService) {
- val appConfigProperties = AppConfigProperties()
- val gIcsConfigProperties = GIcsConfigProperties("http://localhost")
-
- this.consentProcessor =
- ConsentProcessor(
- appConfigProperties,
- gIcsConfigProperties,
- jsonMapper,
- fhirContext,
- consentService,
- )
- }
-
- @ParameterizedTest
- @CsvSource(value = ["permittedConsentBundle.json,permit", "deniedConsentBundle.json,deny"])
- fun checkGetProvisionTypeByPolicyCode(filename: String, expected: String) {
- val bundle =
- fhirContext
- .newJsonParser()
- .parseResource(this.javaClass.classLoader.getResourceAsStream(filename))
- assertThat(bundle).isInstanceOf(Bundle::class.java)
-
- val actual =
- consentProcessor.getProvisionTypeByPolicyCode(
- bundle as Bundle,
- Date(),
- ConsentDomain.BROAD_CONSENT,
- )
-
- assertThat(actual).isEqualTo(Consent.ConsentProvisionType.valueOf(expected.uppercase()))
- }
-}
diff --git a/src/test/kotlin/dev/dnpm/etl/processor/services/ConsentProcessorTest.kt b/src/test/kotlin/dev/dnpm/etl/processor/services/ConsentProcessorTest.kt
index 8899fc6..ea1e74d 100644
--- a/src/test/kotlin/dev/dnpm/etl/processor/services/ConsentProcessorTest.kt
+++ b/src/test/kotlin/dev/dnpm/etl/processor/services/ConsentProcessorTest.kt
@@ -293,4 +293,23 @@ class ConsentProcessorTest {
assertThat(checkResult).isFalse
assertThat(inputMtb.metadata.researchConsents).isEmpty()
}
+
+ @ParameterizedTest
+ @CsvSource(value = ["permittedConsentBundle.json,permit", "deniedConsentBundle.json,deny"])
+ fun checkGetProvisionTypeByPolicyCode(filename: String, expected: String) {
+ val bundle =
+ fhirContext
+ .newJsonParser()
+ .parseResource(this.javaClass.classLoader.getResourceAsStream(filename))
+ assertThat(bundle).isInstanceOf(Bundle::class.java)
+
+ val actual =
+ consentProcessor.getProvisionTypeByPolicyCode(
+ bundle as Bundle,
+ Date(),
+ ConsentDomain.BROAD_CONSENT,
+ )
+
+ assertThat(actual).isEqualTo(Consent.ConsentProvisionType.valueOf(expected.uppercase()))
+ }
}