From 541d2e3a031c710bfc6f17d9069d31394cd55ba3 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Tue, 4 Apr 2023 16:04:54 +0200 Subject: Zusätzliche Prüfung auf Formularname vor Consentübernahme hinzugefügt Diese zusätzliche Prüfung ermöglicht die Erkennung, ob der aktuell ausgewählte ConsentManagerService die entsprechende Prozedur bearbeiten und Consent-Daten in das Formular "DNPM-Klinik/Anamnese" übernehmen kann. Die Standardimplementierung prüft dabei nur, ob die Prozedur nicht `null` ist. --- src/test/java/DNPM/ConsentManagerTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/test/java') diff --git a/src/test/java/DNPM/ConsentManagerTest.java b/src/test/java/DNPM/ConsentManagerTest.java index 41c9a02..e4e33e5 100644 --- a/src/test/java/DNPM/ConsentManagerTest.java +++ b/src/test/java/DNPM/ConsentManagerTest.java @@ -35,6 +35,8 @@ class ConsentManagerTest { void shouldRunServiceMethodsOnAnalyzeCalled() { var consentManagerServiceMock = mock(MrConsentManagerService.class); + when(consentManagerServiceMock.canApply(any(Procedure.class))).thenReturn(true); + when(this.consentManagerServiceFactory.currentUsableInstance()) .thenReturn(consentManagerServiceMock); @@ -43,4 +45,18 @@ class ConsentManagerTest { verify(consentManagerServiceMock, times(1)).applyConsent(any(Procedure.class)); } + @Test + void shouldNotRunServiceMethodsIfProcedureCannotBeAppliesForForm() { + var consentManagerServiceMock = mock(MrConsentManagerService.class); + + when(consentManagerServiceMock.canApply(any(Procedure.class))).thenReturn(false); + + when(this.consentManagerServiceFactory.currentUsableInstance()) + .thenReturn(consentManagerServiceMock); + + this.consentManager.analyze(new Procedure(onkostarApi), null); + + verify(consentManagerServiceMock, times(0)).applyConsent(any(Procedure.class)); + } + } -- cgit v1.2.3