diff options
| author | Paul-Christian Volkmer | 2024-01-12 21:27:55 +0100 |
|---|---|---|
| committer | Paul-Christian Volkmer | 2024-01-12 21:27:55 +0100 |
| commit | 15f043255315e2176fd408aaea94c28f4a4a6855 (patch) | |
| tree | 044d69b9867718e0c15103c8b783edd2d674a2eb | |
| parent | 113bf2dd2ee163f72e4b865f278f8a4a36abe6c9 (diff) | |
test: ensure configured generator bean is created
| -rw-r--r-- | src/integrationTest/kotlin/dev/dnpm/etl/processor/config/AppConfigurationTest.kt | 78 |
1 files changed, 77 insertions, 1 deletions
diff --git a/src/integrationTest/kotlin/dev/dnpm/etl/processor/config/AppConfigurationTest.kt b/src/integrationTest/kotlin/dev/dnpm/etl/processor/config/AppConfigurationTest.kt index 99a5c72..d67b23a 100644 --- a/src/integrationTest/kotlin/dev/dnpm/etl/processor/config/AppConfigurationTest.kt +++ b/src/integrationTest/kotlin/dev/dnpm/etl/processor/config/AppConfigurationTest.kt @@ -1,7 +1,7 @@ /* * This file is part of ETL-Processor * - * Copyright (c) 2023 Comprehensive Cancer Center Mainfranken, Datenintegrationszentrum Philipps-Universität Marburg and Contributors + * Copyright (c) 2024 Comprehensive Cancer Center Mainfranken, 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 @@ -23,6 +23,8 @@ import com.fasterxml.jackson.databind.ObjectMapper import dev.dnpm.etl.processor.monitoring.RequestRepository import dev.dnpm.etl.processor.output.KafkaMtbFileSender import dev.dnpm.etl.processor.output.RestMtbFileSender +import dev.dnpm.etl.processor.pseudonym.AnonymizingGenerator +import dev.dnpm.etl.processor.pseudonym.GpasPseudonymGenerator import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Nested import org.junit.jupiter.api.Test @@ -38,6 +40,11 @@ import org.springframework.test.context.TestPropertySource @SpringBootTest @ContextConfiguration(classes = [AppConfiguration::class, KafkaAutoConfiguration::class, AppKafkaConfiguration::class, AppRestConfiguration::class]) @MockBean(ObjectMapper::class) +@TestPropertySource( + properties = [ + "app.pseudonymize.generator=BUILDIN", + ] +) class AppConfigurationTest { @Nested @@ -116,4 +123,73 @@ class AppConfigurationTest { } + @Nested + inner class AppConfigurationPseudonymizeTest { + + @Nested + @TestPropertySource( + properties = [ + "app.pseudonymize.generator=", + "app.pseudonymizer=buildin", + ] + ) + inner class AppConfigurationPseudonymizerBuildinTest(private val context: ApplicationContext) { + + @Test + fun shouldUseConfiguredGenerator() { + assertThat(context.getBean(AnonymizingGenerator::class.java)).isNotNull + } + + } + + @Nested + @TestPropertySource( + properties = [ + "app.pseudonymize.generator=", + "app.pseudonymizer=gpas", + ] + ) + inner class AppConfigurationPseudonymizerGpasTest(private val context: ApplicationContext) { + + @Test + fun shouldUseConfiguredGenerator() { + assertThat(context.getBean(GpasPseudonymGenerator::class.java)).isNotNull + } + + } + + @Nested + @TestPropertySource( + properties = [ + "app.pseudonymize.generator=buildin", + "app.pseudonymizer=", + ] + ) + inner class AppConfigurationPseudonymizeGeneratorBuildinTest(private val context: ApplicationContext) { + + @Test + fun shouldUseConfiguredGenerator() { + assertThat(context.getBean(AnonymizingGenerator::class.java)).isNotNull + } + + } + + @Nested + @TestPropertySource( + properties = [ + "app.pseudonymize.generator=gpas", + "app.pseudonymizer=", + ] + ) + inner class AppConfigurationPseudonymizeGeneratorGpasTest(private val context: ApplicationContext) { + + @Test + fun shouldUseConfiguredGenerator() { + assertThat(context.getBean(GpasPseudonymGenerator::class.java)).isNotNull + } + + } + + } + }
\ No newline at end of file |
