summaryrefslogtreecommitdiff
path: root/src/test/java/dev/dnpm/oshelper/analyzer
diff options
context:
space:
mode:
authorPaul-Christian Volkmer2026-04-07 10:15:30 +0200
committerGitHub2026-04-07 08:15:30 +0000
commit9afb438eeae0f5a5d6cf63afdaf4b5df8b06a895 (patch)
tree48fec966a5e2f65fbcc2d1e69cc97f8f79ca7cc9 /src/test/java/dev/dnpm/oshelper/analyzer
parent149b33a18dcdfa7500e7d66b5774b2dca14b6f9c (diff)
refactor: remove deprecated MtbService (#260)
Diffstat (limited to 'src/test/java/dev/dnpm/oshelper/analyzer')
-rw-r--r--src/test/java/dev/dnpm/oshelper/analyzer/TherapieplanAnalyzerTest.java61
1 files changed, 5 insertions, 56 deletions
diff --git a/src/test/java/dev/dnpm/oshelper/analyzer/TherapieplanAnalyzerTest.java b/src/test/java/dev/dnpm/oshelper/analyzer/TherapieplanAnalyzerTest.java
index d822f89..0ee1ef8 100644
--- a/src/test/java/dev/dnpm/oshelper/analyzer/TherapieplanAnalyzerTest.java
+++ b/src/test/java/dev/dnpm/oshelper/analyzer/TherapieplanAnalyzerTest.java
@@ -19,27 +19,17 @@
package dev.dnpm.oshelper.analyzer;
-import dev.dnpm.oshelper.security.DelegatingDataBasedPermissionEvaluator;
-import dev.dnpm.oshelper.security.PermissionType;
-import dev.dnpm.oshelper.services.FormService;
-import dev.dnpm.oshelper.services.mtb.MtbService;
-import dev.dnpm.oshelper.services.therapieplan.MultipleMtbTherapieplanService;
-import dev.dnpm.oshelper.services.therapieplan.TherapieplanService;
-import dev.dnpm.oshelper.services.therapieplan.TherapieplanServiceFactory;
import de.itc.onkostar.api.IOnkostarApi;
-import de.itc.onkostar.api.Item;
import de.itc.onkostar.api.Procedure;
+import dev.dnpm.oshelper.services.FormService;
+import dev.dnpm.oshelper.services.therapieplan.DefaultTherapieplanService;
+import dev.dnpm.oshelper.services.therapieplan.TherapieplanServiceFactory;
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)
@@ -54,62 +44,21 @@ class TherapieplanAnalyzerTest {
@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);
+ this.therapieplanAnalyzer = new TherapieplanAnalyzer(therapieplanServiceFactory);
}
@Test
void shouldRunServiceMethodsOnAnalyzeCalled() {
when(this.therapieplanServiceFactory.currentUsableInstance())
- .thenReturn(new MultipleMtbTherapieplanService(onkostarApi, formService));
+ .thenReturn(new DefaultTherapieplanService(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());
- }
-
}