summaryrefslogtreecommitdiff
path: root/src/test/java/dev/dnpm/oshelper/ConsentManagerTest.java
diff options
context:
space:
mode:
authorPaul-Christian Volkmer2026-09-03 14:35:10 +0200
committerGitHub2026-09-03 14:35:10 +0200
commitfb91356b7777dfa5b6088bcc3a48b43924c1c0fd (patch)
treea3d384390e388395953865a286f15292aaa04a86 /src/test/java/dev/dnpm/oshelper/ConsentManagerTest.java
parent59daf77a63bd17bb14248cf9881046dd6b331e2a (diff)
build: apply Spotless plugin (#293)
Diffstat (limited to 'src/test/java/dev/dnpm/oshelper/ConsentManagerTest.java')
-rw-r--r--src/test/java/dev/dnpm/oshelper/ConsentManagerTest.java68
1 files changed, 33 insertions, 35 deletions
diff --git a/src/test/java/dev/dnpm/oshelper/ConsentManagerTest.java b/src/test/java/dev/dnpm/oshelper/ConsentManagerTest.java
index b0dc6a9..80e7298 100644
--- a/src/test/java/dev/dnpm/oshelper/ConsentManagerTest.java
+++ b/src/test/java/dev/dnpm/oshelper/ConsentManagerTest.java
@@ -19,64 +19,62 @@
package dev.dnpm.oshelper;
+import static org.mockito.Mockito.*;
+
+import de.itc.onkostar.api.IOnkostarApi;
+import de.itc.onkostar.api.Procedure;
import dev.dnpm.oshelper.analyzer.ConsentManager;
import dev.dnpm.oshelper.services.consent.ConsentManagerServiceFactory;
import dev.dnpm.oshelper.services.consent.MrConsentManagerService;
-import de.itc.onkostar.api.IOnkostarApi;
-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.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
-import static org.mockito.Mockito.*;
-
@ExtendWith(MockitoExtension.class)
class ConsentManagerTest {
- private IOnkostarApi onkostarApi;
-
- private ConsentManagerServiceFactory consentManagerServiceFactory;
+ private IOnkostarApi onkostarApi;
- private ConsentManager consentManager;
+ private ConsentManagerServiceFactory consentManagerServiceFactory;
- @BeforeEach
- void setup(
- @Mock IOnkostarApi onkostarApi,
- @Mock ConsentManagerServiceFactory consentManagerServiceFactory
- ) {
- this.onkostarApi = onkostarApi;
- this.consentManagerServiceFactory = consentManagerServiceFactory;
- this.consentManager = new ConsentManager(onkostarApi, consentManagerServiceFactory);
- }
+ private ConsentManager consentManager;
- @Test
- void shouldRunServiceMethodsOnAnalyzeCalled() {
- var consentManagerServiceMock = mock(MrConsentManagerService.class);
+ @BeforeEach
+ void setup(
+ @Mock IOnkostarApi onkostarApi,
+ @Mock ConsentManagerServiceFactory consentManagerServiceFactory) {
+ this.onkostarApi = onkostarApi;
+ this.consentManagerServiceFactory = consentManagerServiceFactory;
+ this.consentManager = new ConsentManager(onkostarApi, consentManagerServiceFactory);
+ }
- when(consentManagerServiceMock.canApply(any(Procedure.class))).thenReturn(true);
+ @Test
+ void shouldRunServiceMethodsOnAnalyzeCalled() {
+ var consentManagerServiceMock = mock(MrConsentManagerService.class);
- when(this.consentManagerServiceFactory.currentUsableInstance())
- .thenReturn(consentManagerServiceMock);
+ when(consentManagerServiceMock.canApply(any(Procedure.class))).thenReturn(true);
- this.consentManager.analyze(new Procedure(onkostarApi), null);
+ when(this.consentManagerServiceFactory.currentUsableInstance())
+ .thenReturn(consentManagerServiceMock);
- verify(consentManagerServiceMock, times(1)).applyConsent(any(Procedure.class));
- }
+ this.consentManager.analyze(new Procedure(onkostarApi), null);
- @Test
- void shouldNotRunServiceMethodsIfProcedureCannotBeAppliesForForm() {
- var consentManagerServiceMock = mock(MrConsentManagerService.class);
+ verify(consentManagerServiceMock, times(1)).applyConsent(any(Procedure.class));
+ }
- when(consentManagerServiceMock.canApply(any(Procedure.class))).thenReturn(false);
+ @Test
+ void shouldNotRunServiceMethodsIfProcedureCannotBeAppliesForForm() {
+ var consentManagerServiceMock = mock(MrConsentManagerService.class);
- when(this.consentManagerServiceFactory.currentUsableInstance())
- .thenReturn(consentManagerServiceMock);
+ when(consentManagerServiceMock.canApply(any(Procedure.class))).thenReturn(false);
- this.consentManager.analyze(new Procedure(onkostarApi), null);
+ when(this.consentManagerServiceFactory.currentUsableInstance())
+ .thenReturn(consentManagerServiceMock);
- verify(consentManagerServiceMock, times(0)).applyConsent(any(Procedure.class));
- }
+ this.consentManager.analyze(new Procedure(onkostarApi), null);
+ verify(consentManagerServiceMock, times(0)).applyConsent(any(Procedure.class));
+ }
}