🎨 升级Mockito版本

This commit is contained in:
Binary Wang
2026-01-15 17:30:54 +08:00
parent 73704ca280
commit 30914f371d
15 changed files with 34 additions and 38 deletions

View File

@@ -257,8 +257,8 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId> <artifactId>mockito-core</artifactId>
<version>1.10.19</version> <version>5.14.2</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@@ -121,12 +121,7 @@
<artifactId>jedis-lock</artifactId> <artifactId>jedis-lock</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.3.3</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@@ -86,6 +86,11 @@
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
@@ -97,11 +102,7 @@
<artifactId>testng</artifactId> <artifactId>testng</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>com.google.inject</groupId> <groupId>com.google.inject</groupId>
<artifactId>guice</artifactId> <artifactId>guice</artifactId>

View File

@@ -57,6 +57,7 @@
<groupId>org.springframework.data</groupId> <groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId> <artifactId>spring-data-redis</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.testng</groupId> <groupId>org.testng</groupId>
<artifactId>testng</artifactId> <artifactId>testng</artifactId>
@@ -64,9 +65,10 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId> <artifactId>mockito-core</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.inject</groupId> <groupId>com.google.inject</groupId>
<artifactId>guice</artifactId> <artifactId>guice</artifactId>

View File

@@ -13,8 +13,8 @@ import org.testng.annotations.Test;
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Tp.GET_CUSTOMIZED_APP_DETAIL; import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Tp.GET_CUSTOMIZED_APP_DETAIL;
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Tp.GET_TEMPLATE_LIST; import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Tp.GET_TEMPLATE_LIST;
import static org.mockito.Matchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Matchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;

View File

@@ -11,8 +11,8 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Tp.PROLONG_TRY; import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Tp.PROLONG_TRY;
import static org.mockito.Matchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Matchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
@@ -34,7 +34,7 @@ public class WxCpTpEditionServiceImplTest {
*/ */
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.openMocks(this);
configStorage = new WxCpTpDefaultConfigImpl(); configStorage = new WxCpTpDefaultConfigImpl();
when(wxCpTpService.getWxCpTpConfigStorage()).thenReturn(configStorage); when(wxCpTpService.getWxCpTpConfigStorage()).thenReturn(configStorage);
wxCpTpEditionService = new WxCpTpEditionServiceImpl(wxCpTpService); wxCpTpEditionService = new WxCpTpEditionServiceImpl(wxCpTpService);

View File

@@ -16,8 +16,8 @@ import org.testng.annotations.Test;
import java.util.*; import java.util.*;
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.License.*; import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.License.*;
import static org.mockito.Matchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Matchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
@@ -41,7 +41,7 @@ public class WxCpTpLicenseServiceImplTest {
*/ */
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.openMocks(this);
configStorage = new WxCpTpDefaultConfigImpl(); configStorage = new WxCpTpDefaultConfigImpl();
when(wxCpTpService.getWxCpTpConfigStorage()).thenReturn(configStorage); when(wxCpTpService.getWxCpTpConfigStorage()).thenReturn(configStorage);
wxCpTpLicenseService = new WxCpTpLicenseServiceImpl(wxCpTpService); wxCpTpLicenseService = new WxCpTpLicenseServiceImpl(wxCpTpService);

View File

@@ -18,8 +18,8 @@ import java.util.Objects;
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Tp.GET_ORDER; import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Tp.GET_ORDER;
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Tp.GET_ORDER_LIST; import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Tp.GET_ORDER_LIST;
import static org.mockito.Matchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Matchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import static org.testng.Assert.*; import static org.testng.Assert.*;
@@ -40,7 +40,7 @@ public class WxCpTpOrderServiceImplTest {
*/ */
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.openMocks(this);
configStorage = new WxCpTpDefaultConfigImpl(); configStorage = new WxCpTpDefaultConfigImpl();
when(wxCpTpService.getWxCpTpConfigStorage()).thenReturn(configStorage); when(wxCpTpService.getWxCpTpConfigStorage()).thenReturn(configStorage);
wxCpTpOrderService = new WxCpTpOrderServiceImpl(wxCpTpService); wxCpTpOrderService = new WxCpTpOrderServiceImpl(wxCpTpService);

View File

@@ -17,7 +17,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Tag.*; import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Tag.*;
import static org.mockito.Matchers.*; import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import static org.testng.Assert.*; import static org.testng.Assert.*;
@@ -41,7 +41,7 @@ public class WxCpTpTagServiceImplTest {
*/ */
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.openMocks(this);
configStorage = new WxCpTpDefaultConfigImpl(); configStorage = new WxCpTpDefaultConfigImpl();
when(wxCpTpService.getWxCpTpConfigStorage()).thenReturn(configStorage); when(wxCpTpService.getWxCpTpConfigStorage()).thenReturn(configStorage);
wxCpTpTagService = new WxCpTpTagServiceImpl(wxCpTpService); wxCpTpTagService = new WxCpTpTagServiceImpl(wxCpTpService);

View File

@@ -106,9 +106,9 @@
<dependency> <dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId> <artifactId>mockito-core</artifactId>
<version>3.3.3</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>

View File

@@ -54,9 +54,11 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId> <artifactId>mockito-core</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.inject</groupId> <groupId>com.google.inject</groupId>
<artifactId>guice</artifactId> <artifactId>guice</artifactId>

View File

@@ -10,7 +10,7 @@ import org.testng.annotations.Guice;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.anyString; import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy; import static org.mockito.Mockito.spy;

View File

@@ -24,7 +24,7 @@ import java.net.URL;
import java.util.UUID; import java.util.UUID;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.anyString; import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;

View File

@@ -11,8 +11,8 @@ import org.testng.annotations.Test;
import static me.chanjar.weixin.mp.enums.WxMpApiUrl.Wifi.BIZWIFI_SHOP_GET; import static me.chanjar.weixin.mp.enums.WxMpApiUrl.Wifi.BIZWIFI_SHOP_GET;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.anyString; import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Matchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;

View File

@@ -47,11 +47,7 @@
<artifactId>testng</artifactId> <artifactId>testng</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>com.google.inject</groupId> <groupId>com.google.inject</groupId>
<artifactId>guice</artifactId> <artifactId>guice</artifactId>