Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
max402 committed Sep 19, 2023
1 parent 6f1bdf5 commit 1659fa3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 20 deletions.
5 changes: 0 additions & 5 deletions datasafe-storage/datasafe-storage-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
Expand Down
5 changes: 0 additions & 5 deletions datasafe-types-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,6 @@
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
Expand Down

0 comments on commit 1659fa3

Please sign in to comment.