From 1659fa32975ac0cf7843bafaa9c65576260337b9 Mon Sep 17 00:00:00 2001 From: Maxim Grischenko Date: Tue, 19 Sep 2023 10:00:28 +0200 Subject: [PATCH] fix test --- datasafe-storage/datasafe-storage-api/pom.xml | 5 ----- datasafe-types-api/pom.xml | 5 ----- .../datasafe/types/api/shared/BaseMockitoTest.java | 10 ++++++---- pom.xml | 6 ------ 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/datasafe-storage/datasafe-storage-api/pom.xml b/datasafe-storage/datasafe-storage-api/pom.xml index 9b8c62ab0..15ce59cd4 100644 --- a/datasafe-storage/datasafe-storage-api/pom.xml +++ b/datasafe-storage/datasafe-storage-api/pom.xml @@ -32,11 +32,6 @@ junit-jupiter-api test - - org.mockito - mockito-junit-jupiter - test - org.assertj assertj-core diff --git a/datasafe-types-api/pom.xml b/datasafe-types-api/pom.xml index 134ea2919..0a793d1ad 100644 --- a/datasafe-types-api/pom.xml +++ b/datasafe-types-api/pom.xml @@ -39,11 +39,6 @@ mockito-core test - - org.mockito - mockito-junit-jupiter - test - com.google.guava guava diff --git a/datasafe-types-api/src/test/java/de/adorsys/datasafe/types/api/shared/BaseMockitoTest.java b/datasafe-types-api/src/test/java/de/adorsys/datasafe/types/api/shared/BaseMockitoTest.java index 049935ab4..faad83a75 100644 --- a/datasafe-types-api/src/test/java/de/adorsys/datasafe/types/api/shared/BaseMockitoTest.java +++ b/datasafe-types-api/src/test/java/de/adorsys/datasafe/types/api/shared/BaseMockitoTest.java @@ -3,27 +3,29 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mockito; -import org.mockito.junit.jupiter.MockitoExtension; +import org.mockito.MockitoAnnotations; /** * This class configures Mockito so that it will inject annotated mocks and display exceptions always * at correct places. * Tests that use Mockito should use this class. */ -@ExtendWith(MockitoExtension.class) public abstract class BaseMockitoTest { + AutoCloseable openMocks; + @BeforeEach public void setup() { + openMocks = MockitoAnnotations.openMocks(this); System.setProperty("SECURE_LOGS", "off"); System.setProperty("SECURE_SENSITIVE", "off"); } @AfterEach - public void validate() { + public void validate() throws Exception { Mockito.validateMockitoUsage(); + openMocks.close(); } @AfterAll diff --git a/pom.xml b/pom.xml index c3c8b7195..bc09f0b75 100644 --- a/pom.xml +++ b/pom.xml @@ -275,12 +275,6 @@ ${mockito.version} test - - org.mockito - mockito-junit-jupiter - ${mockito.version} - test - org.testcontainers testcontainers