Skip to content

Commit

Permalink
fixed Mockito instrumentation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-kuba committed Nov 22, 2024
1 parent 9036436 commit 570f819
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
25 changes: 25 additions & 0 deletions chat-server-generated/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,31 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<argLine>-Xshare:off -javaagent:${org.mockito:mockito-core:jar}</argLine>
</configuration>
</plugin>
<!--
Mockito instrumentation for JDK 21+
https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#mockito-instrumentation
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>properties</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Xshare:off -javaagent:${org.mockito:mockito-core:jar}</argLine>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
27 changes: 27 additions & 0 deletions chat-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,34 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<argLine>-Xshare:off -javaagent:${org.mockito:mockito-core:jar}</argLine>
</configuration>
</plugin>

<!--
Mockito instrumentation for JDK 21+
https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#mockito-instrumentation
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>properties</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Xshare:off -javaagent:${org.mockito:mockito-core:jar}</argLine>
</configuration>
</plugin>

</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.config.EnableSpringDataWebSupport;
import org.springframework.http.MediaType;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.web.servlet.MockMvc;

import java.time.ZoneId;
Expand Down Expand Up @@ -57,7 +57,7 @@ class ChatRestControllerUnitTests {
private MockMvc mockMvc;

// injected mock implementation of the ChatService interface
@MockBean
@MockitoBean
private ChatService mockChatService;

// injected mapper for converting classes into JSON strings
Expand Down

0 comments on commit 570f819

Please sign in to comment.