diff options
| author | Paul-Christian Volkmer | 2023-03-20 22:59:02 +0100 |
|---|---|---|
| committer | GitHub | 2023-03-20 22:59:02 +0100 |
| commit | 7fe580733c1354ef8ea5a7071aeae6818a97f7cf (patch) | |
| tree | 271dc83ad9f4f4e72250b396662db92f3e37bfbe /src/test/java/DNPM/config/TherapieplanServiceFactoryTest.java | |
| parent | a8a5e1be8a8bc8a048106b608fa4f58d80a66444 (diff) | |
| parent | aad777b5e36238ef437210bd9ad3ea51c3274a45 (diff) | |
Merge pull request #12 from CCC-MF/issue_11
Übernahme des MTB-Protokolls in DNPM-Therapieplan - Protokollauszug
Diffstat (limited to 'src/test/java/DNPM/config/TherapieplanServiceFactoryTest.java')
| -rw-r--r-- | src/test/java/DNPM/config/TherapieplanServiceFactoryTest.java | 37 |
1 files changed, 7 insertions, 30 deletions
diff --git a/src/test/java/DNPM/config/TherapieplanServiceFactoryTest.java b/src/test/java/DNPM/config/TherapieplanServiceFactoryTest.java index f974dcf..ea9ff42 100644 --- a/src/test/java/DNPM/config/TherapieplanServiceFactoryTest.java +++ b/src/test/java/DNPM/config/TherapieplanServiceFactoryTest.java @@ -1,9 +1,6 @@ package DNPM.config; -import DNPM.services.DefaultTherapieplanService; -import DNPM.services.FormService; -import DNPM.services.MultipleMtbTherapieplanService; -import DNPM.services.TherapieplanServiceFactory; +import DNPM.services.*; import de.itc.onkostar.api.IOnkostarApi; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -12,8 +9,6 @@ import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) @@ -25,31 +20,19 @@ public class TherapieplanServiceFactoryTest { @Mock private FormService formService; + @Mock + private SettingsService settingsService; + private TherapieplanServiceFactory therapieplanServiceFactory; @BeforeEach void setup() { - this.therapieplanServiceFactory = new TherapieplanServiceFactory(onkostarApi, formService); + this.therapieplanServiceFactory = new TherapieplanServiceFactory(onkostarApi, settingsService, formService); } @Test void testShouldReturnDefaultTherapieplanServiceIfSettingIsFalse() { - doAnswer(invocationOnMock -> { - var settingName = invocationOnMock.getArgument(0, String.class); - if (settingName.equals("mehrere_mtb_in_mtbepisode")) { - return "false"; - } - return null; - }).when(onkostarApi).getGlobalSetting(anyString()); - - var actual = this.therapieplanServiceFactory.currentUsableInstance(); - - assertThat(actual).isInstanceOf(DefaultTherapieplanService.class); - } - - @Test - void testShouldReturnDefaultTherapieplanServiceIfNoSetting() { - when(onkostarApi.getGlobalSetting(anyString())).thenReturn(null); + when(settingsService.multipleMtbsInMtbEpisode()).thenReturn(false); var actual = this.therapieplanServiceFactory.currentUsableInstance(); @@ -58,13 +41,7 @@ public class TherapieplanServiceFactoryTest { @Test void testShouldReturnMultipleMtbTherapieplanServiceIfSettingIsTrue() { - doAnswer(invocationOnMock -> { - var settingName = invocationOnMock.getArgument(0, String.class); - if (settingName.equals("mehrere_mtb_in_mtbepisode")) { - return "true"; - } - return null; - }).when(onkostarApi).getGlobalSetting(anyString()); + when(settingsService.multipleMtbsInMtbEpisode()).thenReturn(true); var actual = this.therapieplanServiceFactory.currentUsableInstance(); |
