From be12a32b814b0a2b9a5a257fd6bdbf0bb1213669 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Tue, 4 Apr 2023 16:13:21 +0200 Subject: Verschiebe Tests in korrekte Pakete --- .../config/ConsentManagerServiceFactoryTest.java | 54 ---------------------- .../config/TherapieplanServiceFactoryTest.java | 50 -------------------- 2 files changed, 104 deletions(-) delete mode 100644 src/test/java/DNPM/config/ConsentManagerServiceFactoryTest.java delete mode 100644 src/test/java/DNPM/config/TherapieplanServiceFactoryTest.java (limited to 'src/test/java/DNPM/config') diff --git a/src/test/java/DNPM/config/ConsentManagerServiceFactoryTest.java b/src/test/java/DNPM/config/ConsentManagerServiceFactoryTest.java deleted file mode 100644 index 6e32e7f..0000000 --- a/src/test/java/DNPM/config/ConsentManagerServiceFactoryTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package DNPM.config; - -import DNPM.services.consent.ConsentManagerService; -import DNPM.services.consent.ConsentManagerServiceFactory; -import DNPM.services.consent.MrConsentManagerService; -import DNPM.services.consent.UkwConsentManagerService; -import de.itc.onkostar.api.IOnkostarApi; -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.MethodSource; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - -import java.util.Map; -import java.util.Set; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.when; - -@ExtendWith(MockitoExtension.class) -class ConsentManagerServiceFactoryTest { - - private IOnkostarApi onkostarApi; - - private ConsentManagerServiceFactory consentManagerServiceFactory; - - @BeforeEach - void setup( - @Mock IOnkostarApi onkostarApi - ) { - this.onkostarApi = onkostarApi; - this.consentManagerServiceFactory = new ConsentManagerServiceFactory(onkostarApi); - } - - private static Set>> expectedMappings() { - return Map.ofEntries( - Map.entry("MR.Consent", MrConsentManagerService.class), - Map.entry("Excel-Formular", UkwConsentManagerService.class) - ).entrySet(); - } - - @ParameterizedTest - @MethodSource("expectedMappings") - void testShouldMapFormNameToService(Map.Entry> expectedMapping) { - when(onkostarApi.getGlobalSetting(anyString())).thenReturn(expectedMapping.getKey()); - - var actual = consentManagerServiceFactory.currentUsableInstance(); - - assertThat(actual).isExactlyInstanceOf(expectedMapping.getValue()); - } - -} diff --git a/src/test/java/DNPM/config/TherapieplanServiceFactoryTest.java b/src/test/java/DNPM/config/TherapieplanServiceFactoryTest.java deleted file mode 100644 index ad1b66b..0000000 --- a/src/test/java/DNPM/config/TherapieplanServiceFactoryTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package DNPM.config; - -import DNPM.services.*; -import de.itc.onkostar.api.IOnkostarApi; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.when; - -@ExtendWith(MockitoExtension.class) -class TherapieplanServiceFactoryTest { - - @Mock - private IOnkostarApi onkostarApi; - - @Mock - private FormService formService; - - @Mock - private SettingsService settingsService; - - private TherapieplanServiceFactory therapieplanServiceFactory; - - @BeforeEach - void setup() { - this.therapieplanServiceFactory = new TherapieplanServiceFactory(onkostarApi, settingsService, formService); - } - - @Test - void testShouldReturnDefaultTherapieplanServiceIfSettingIsFalse() { - when(settingsService.multipleMtbsInMtbEpisode()).thenReturn(false); - - var actual = this.therapieplanServiceFactory.currentUsableInstance(); - - assertThat(actual).isInstanceOf(DefaultTherapieplanService.class); - } - - @Test - void testShouldReturnMultipleMtbTherapieplanServiceIfSettingIsTrue() { - when(settingsService.multipleMtbsInMtbEpisode()).thenReturn(true); - - var actual = this.therapieplanServiceFactory.currentUsableInstance(); - - assertThat(actual).isInstanceOf(MultipleMtbTherapieplanService.class); - } -} -- cgit v1.2.3