🎨 降级 Mockito 至 4.11.0 以兼容 Java 8
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -258,7 +258,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
<version>5.14.2</version>
|
<version>4.11.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import me.chanjar.weixin.cp.config.impl.WxCpTpDefaultConfigImpl;
|
|||||||
import me.chanjar.weixin.cp.tp.service.WxCpTpCustomizedService;
|
import me.chanjar.weixin.cp.tp.service.WxCpTpCustomizedService;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
|
import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@@ -34,17 +35,29 @@ public class WxCpTpCustomizedServiceImplTest {
|
|||||||
|
|
||||||
private WxCpTpCustomizedService wxCpTpCustomizedService;
|
private WxCpTpCustomizedService wxCpTpCustomizedService;
|
||||||
|
|
||||||
|
private AutoCloseable mockitoAnnotations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up.
|
* Sets up.
|
||||||
*/
|
*/
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.initMocks(this);
|
mockitoAnnotations = MockitoAnnotations.openMocks(this);
|
||||||
configStorage = new WxCpTpDefaultConfigImpl();
|
configStorage = new WxCpTpDefaultConfigImpl();
|
||||||
when(wxCpTpService.getWxCpTpConfigStorage()).thenReturn(configStorage);
|
when(wxCpTpService.getWxCpTpConfigStorage()).thenReturn(configStorage);
|
||||||
wxCpTpCustomizedService = new WxCpTpCustomizedServiceImpl(wxCpTpService);
|
wxCpTpCustomizedService = new WxCpTpCustomizedServiceImpl(wxCpTpService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tear down.
|
||||||
|
*
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
@AfterClass
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
mockitoAnnotations.close();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试获取应用模板列表
|
* 测试获取应用模板列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import me.chanjar.weixin.cp.config.impl.WxCpTpDefaultConfigImpl;
|
|||||||
import me.chanjar.weixin.cp.tp.service.WxCpTpEditionService;
|
import me.chanjar.weixin.cp.tp.service.WxCpTpEditionService;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
|
import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@@ -29,18 +30,31 @@ public class WxCpTpEditionServiceImplTest {
|
|||||||
|
|
||||||
private WxCpTpEditionService wxCpTpEditionService;
|
private WxCpTpEditionService wxCpTpEditionService;
|
||||||
|
|
||||||
|
private AutoCloseable mockitoAnnotations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up.
|
* Sets up.
|
||||||
*/
|
*/
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.openMocks(this);
|
mockitoAnnotations = 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tear down.
|
||||||
|
*
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
@AfterClass
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
mockitoAnnotations.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 延长试用期
|
* 延长试用期
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import me.chanjar.weixin.cp.config.impl.WxCpTpDefaultConfigImpl;
|
|||||||
import me.chanjar.weixin.cp.tp.service.WxCpTpLicenseService;
|
import me.chanjar.weixin.cp.tp.service.WxCpTpLicenseService;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
|
import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@@ -36,18 +37,31 @@ public class WxCpTpLicenseServiceImplTest {
|
|||||||
|
|
||||||
private WxCpTpLicenseService wxCpTpLicenseService;
|
private WxCpTpLicenseService wxCpTpLicenseService;
|
||||||
|
|
||||||
|
private AutoCloseable mockitoAnnotations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up.
|
* Sets up.
|
||||||
*/
|
*/
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.openMocks(this);
|
mockitoAnnotations = 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tear down.
|
||||||
|
*
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
@AfterClass
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
mockitoAnnotations.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test crate new order.
|
* Test crate new order.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import me.chanjar.weixin.cp.tp.service.WxCpTpOrderService;
|
|||||||
import org.apache.commons.lang3.time.DateUtils;
|
import org.apache.commons.lang3.time.DateUtils;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
|
import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@@ -35,18 +36,31 @@ public class WxCpTpOrderServiceImplTest {
|
|||||||
|
|
||||||
private WxCpTpOrderService wxCpTpOrderService;
|
private WxCpTpOrderService wxCpTpOrderService;
|
||||||
|
|
||||||
|
private AutoCloseable mockitoAnnotations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up.
|
* Sets up.
|
||||||
*/
|
*/
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.openMocks(this);
|
mockitoAnnotations = 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tear down.
|
||||||
|
*
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
@AfterClass
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
mockitoAnnotations.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取订单详情
|
* 获取订单详情
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import me.chanjar.weixin.cp.config.impl.WxCpTpDefaultConfigImpl;
|
|||||||
import me.chanjar.weixin.cp.tp.service.WxCpTpTagService;
|
import me.chanjar.weixin.cp.tp.service.WxCpTpTagService;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
|
import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
import org.testng.collections.CollectionUtils;
|
import org.testng.collections.CollectionUtils;
|
||||||
@@ -36,17 +37,29 @@ public class WxCpTpTagServiceImplTest {
|
|||||||
|
|
||||||
private WxCpTpTagService wxCpTpTagService;
|
private WxCpTpTagService wxCpTpTagService;
|
||||||
|
|
||||||
|
private AutoCloseable mockitoAnnotations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up.
|
* Sets up.
|
||||||
*/
|
*/
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.openMocks(this);
|
mockitoAnnotations = 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tear down.
|
||||||
|
*
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
@AfterClass
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
mockitoAnnotations.close();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test create.
|
* Test create.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user