diff options
| author | Paul-Christian Volkmer | 2025-10-23 11:08:10 +0200 |
|---|---|---|
| committer | Paul-Christian Volkmer | 2025-10-23 11:09:54 +0200 |
| commit | 84fb0d829832bf1628112376bba729422b169402 (patch) | |
| tree | 4828674b77105877dccfcccb380da3f7c0f75987 /src/test/java/dev/dnpm/analyzer/TherapieplanAnalyzerTest.java | |
| parent | 61e7dfcbe637f401f81ff853e9bd10c90b325acb (diff) | |
refactor: change package name
Diffstat (limited to 'src/test/java/dev/dnpm/analyzer/TherapieplanAnalyzerTest.java')
| -rw-r--r-- | src/test/java/dev/dnpm/analyzer/TherapieplanAnalyzerTest.java | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/src/test/java/dev/dnpm/analyzer/TherapieplanAnalyzerTest.java b/src/test/java/dev/dnpm/analyzer/TherapieplanAnalyzerTest.java deleted file mode 100644 index 2f22e37..0000000 --- a/src/test/java/dev/dnpm/analyzer/TherapieplanAnalyzerTest.java +++ /dev/null @@ -1,96 +0,0 @@ -package dev.dnpm.analyzer; - -import dev.dnpm.security.DelegatingDataBasedPermissionEvaluator; -import dev.dnpm.security.PermissionType; -import dev.dnpm.services.FormService; -import dev.dnpm.services.mtb.MtbService; -import dev.dnpm.services.therapieplan.MultipleMtbTherapieplanService; -import dev.dnpm.services.therapieplan.TherapieplanService; -import dev.dnpm.services.therapieplan.TherapieplanServiceFactory; -import de.itc.onkostar.api.IOnkostarApi; -import de.itc.onkostar.api.Item; -import de.itc.onkostar.api.Procedure; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.*; - -@ExtendWith(MockitoExtension.class) -class TherapieplanAnalyzerTest { - - @Mock - private IOnkostarApi onkostarApi; - - @Mock - private FormService formService; - - @Mock - private TherapieplanServiceFactory therapieplanServiceFactory; - - @Mock - private TherapieplanService therapieplanService; - - @Mock - private MtbService mtbService; - - @Mock - private DelegatingDataBasedPermissionEvaluator permissionEvaluator; - - private TherapieplanAnalyzer therapieplanAnalyzer; - - @BeforeEach - void setUp() { - this.therapieplanAnalyzer = new TherapieplanAnalyzer(therapieplanServiceFactory, mtbService, permissionEvaluator); - } - - @Test - void shouldRunServiceMethodsOnAnalyzeCalled() { - when(this.therapieplanServiceFactory.currentUsableInstance()) - .thenReturn(new MultipleMtbTherapieplanService(onkostarApi, formService)); - - this.therapieplanAnalyzer.analyze(new Procedure(onkostarApi), null); - - verify(this.therapieplanServiceFactory, times(1)).currentUsableInstance(); - } - - @Test - void shouldRequestProtokollauszug() { - doAnswer(invocationOnMock -> { - var procedure = new Procedure(onkostarApi); - procedure.setValue("referstemtb", new Item("referstemtb", 2345)); - return List.of(procedure); - }).when(this.therapieplanService).findReferencedMtbs(anyInt()); - - when(this.therapieplanServiceFactory.currentUsableInstance()) - .thenReturn(therapieplanService); - - when(this.permissionEvaluator.hasPermission(any(), anyInt(), anyString(), any(PermissionType.class))).thenReturn(true); - - var input = Map.of("id", (Object) 1234); - this.therapieplanAnalyzer.getProtokollauszug(input); - - var captor = ArgumentCaptor.forClass(List.class); - verify(mtbService, times(1)).getProtocol(captor.capture()); - assertThat(captor.getValue()).hasSize(1); - } - - @Test - void shouldNotRequestProtokollauszugDueToNoPermission() { - when(this.permissionEvaluator.hasPermission(any(), anyInt(), anyString(), any(PermissionType.class))) - .thenReturn(false); - - var input = Map.of("id", (Object) 1234); - this.therapieplanAnalyzer.getProtokollauszug(input); - - verify(mtbService, times(0)).getProtocol(anyList()); - } - -} |
