diff options
| author | Paul-Christian Volkmer | 2023-04-04 16:13:21 +0200 |
|---|---|---|
| committer | Paul-Christian Volkmer | 2023-04-04 16:13:21 +0200 |
| commit | be12a32b814b0a2b9a5a257fd6bdbf0bb1213669 (patch) | |
| tree | c2881697fd165ba1de26930c8a9e94c52d3ac598 /src/test/java/DNPM/services/TherapieplanServiceFactoryTest.java | |
| parent | 541d2e3a031c710bfc6f17d9069d31394cd55ba3 (diff) | |
Verschiebe Tests in korrekte Pakete
Diffstat (limited to 'src/test/java/DNPM/services/TherapieplanServiceFactoryTest.java')
| -rw-r--r-- | src/test/java/DNPM/services/TherapieplanServiceFactoryTest.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/test/java/DNPM/services/TherapieplanServiceFactoryTest.java b/src/test/java/DNPM/services/TherapieplanServiceFactoryTest.java new file mode 100644 index 0000000..9ba543f --- /dev/null +++ b/src/test/java/DNPM/services/TherapieplanServiceFactoryTest.java @@ -0,0 +1,49 @@ +package 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); + } +} |
