File tree Expand file tree Collapse file tree 6 files changed +74
-6
lines changed
weixin-java-cp/src/test/java/me/chanjar/weixin/cp/tp/service/impl Expand file tree Collapse file tree 6 files changed +74
-6
lines changed Original file line number Diff line number Diff line change 258258 <dependency >
259259 <groupId >org.mockito</groupId >
260260 <artifactId >mockito-core</artifactId >
261- <version >5.14.2 </version >
261+ <version >4.11.0 </version >
262262 <scope >test</scope >
263263 </dependency >
264264 <dependency >
Original file line number Diff line number Diff line change 88import me .chanjar .weixin .cp .tp .service .WxCpTpCustomizedService ;
99import org .mockito .Mock ;
1010import org .mockito .MockitoAnnotations ;
11+ import org .testng .annotations .AfterClass ;
1112import org .testng .annotations .BeforeClass ;
1213import org .testng .annotations .Test ;
1314
@@ -34,17 +35,29 @@ public class WxCpTpCustomizedServiceImplTest {
3435
3536 private WxCpTpCustomizedService wxCpTpCustomizedService ;
3637
38+ private AutoCloseable mockitoAnnotations ;
39+
3740 /**
3841 * Sets up.
3942 */
4043 @ BeforeClass
4144 public void setUp () {
42- MockitoAnnotations .initMocks (this );
45+ mockitoAnnotations = MockitoAnnotations .openMocks (this );
4346 configStorage = new WxCpTpDefaultConfigImpl ();
4447 when (wxCpTpService .getWxCpTpConfigStorage ()).thenReturn (configStorage );
4548 wxCpTpCustomizedService = new WxCpTpCustomizedServiceImpl (wxCpTpService );
4649 }
4750
51+ /**
52+ * Tear down.
53+ *
54+ * @throws Exception the exception
55+ */
56+ @ AfterClass
57+ public void tearDown () throws Exception {
58+ mockitoAnnotations .close ();
59+ }
60+
4861 /**
4962 * 测试获取应用模板列表
5063 *
Original file line number Diff line number Diff line change 77import me .chanjar .weixin .cp .tp .service .WxCpTpEditionService ;
88import org .mockito .Mock ;
99import org .mockito .MockitoAnnotations ;
10+ import org .testng .annotations .AfterClass ;
1011import org .testng .annotations .BeforeClass ;
1112import org .testng .annotations .Test ;
1213
@@ -29,18 +30,31 @@ public class WxCpTpEditionServiceImplTest {
2930
3031 private WxCpTpEditionService wxCpTpEditionService ;
3132
33+ private AutoCloseable mockitoAnnotations ;
34+
3235 /**
3336 * Sets up.
3437 */
3538 @ BeforeClass
3639 public void setUp () {
37- MockitoAnnotations .openMocks (this );
40+ mockitoAnnotations = MockitoAnnotations .openMocks (this );
3841 configStorage = new WxCpTpDefaultConfigImpl ();
3942 when (wxCpTpService .getWxCpTpConfigStorage ()).thenReturn (configStorage );
4043 wxCpTpEditionService = new WxCpTpEditionServiceImpl (wxCpTpService );
4144 }
4245
4346
47+ /**
48+ * Tear down.
49+ *
50+ * @throws Exception the exception
51+ */
52+ @ AfterClass
53+ public void tearDown () throws Exception {
54+ mockitoAnnotations .close ();
55+ }
56+
57+
4458 /**
4559 * 延长试用期
4660 *
Original file line number Diff line number Diff line change 1010import me .chanjar .weixin .cp .tp .service .WxCpTpLicenseService ;
1111import org .mockito .Mock ;
1212import org .mockito .MockitoAnnotations ;
13+ import org .testng .annotations .AfterClass ;
1314import org .testng .annotations .BeforeClass ;
1415import org .testng .annotations .Test ;
1516
@@ -36,18 +37,31 @@ public class WxCpTpLicenseServiceImplTest {
3637
3738 private WxCpTpLicenseService wxCpTpLicenseService ;
3839
40+ private AutoCloseable mockitoAnnotations ;
41+
3942 /**
4043 * Sets up.
4144 */
4245 @ BeforeClass
4346 public void setUp () {
44- MockitoAnnotations .openMocks (this );
47+ mockitoAnnotations = MockitoAnnotations .openMocks (this );
4548 configStorage = new WxCpTpDefaultConfigImpl ();
4649 when (wxCpTpService .getWxCpTpConfigStorage ()).thenReturn (configStorage );
4750 wxCpTpLicenseService = new WxCpTpLicenseServiceImpl (wxCpTpService );
4851 }
4952
5053
54+ /**
55+ * Tear down.
56+ *
57+ * @throws Exception the exception
58+ */
59+ @ AfterClass
60+ public void tearDown () throws Exception {
61+ mockitoAnnotations .close ();
62+ }
63+
64+
5165 /**
5266 * Test crate new order.
5367 *
Original file line number Diff line number Diff line change 99import org .apache .commons .lang3 .time .DateUtils ;
1010import org .mockito .Mock ;
1111import org .mockito .MockitoAnnotations ;
12+ import org .testng .annotations .AfterClass ;
1213import org .testng .annotations .BeforeClass ;
1314import org .testng .annotations .Test ;
1415
@@ -35,18 +36,31 @@ public class WxCpTpOrderServiceImplTest {
3536
3637 private WxCpTpOrderService wxCpTpOrderService ;
3738
39+ private AutoCloseable mockitoAnnotations ;
40+
3841 /**
3942 * Sets up.
4043 */
4144 @ BeforeClass
4245 public void setUp () {
43- MockitoAnnotations .openMocks (this );
46+ mockitoAnnotations = MockitoAnnotations .openMocks (this );
4447 configStorage = new WxCpTpDefaultConfigImpl ();
4548 when (wxCpTpService .getWxCpTpConfigStorage ()).thenReturn (configStorage );
4649 wxCpTpOrderService = new WxCpTpOrderServiceImpl (wxCpTpService );
4750 }
4851
4952
53+ /**
54+ * Tear down.
55+ *
56+ * @throws Exception the exception
57+ */
58+ @ AfterClass
59+ public void tearDown () throws Exception {
60+ mockitoAnnotations .close ();
61+ }
62+
63+
5064 /**
5165 * 获取订单详情
5266 *
Original file line number Diff line number Diff line change 99import me .chanjar .weixin .cp .tp .service .WxCpTpTagService ;
1010import org .mockito .Mock ;
1111import org .mockito .MockitoAnnotations ;
12+ import org .testng .annotations .AfterClass ;
1213import org .testng .annotations .BeforeClass ;
1314import org .testng .annotations .Test ;
1415import org .testng .collections .CollectionUtils ;
@@ -36,17 +37,29 @@ public class WxCpTpTagServiceImplTest {
3637
3738 private WxCpTpTagService wxCpTpTagService ;
3839
40+ private AutoCloseable mockitoAnnotations ;
41+
3942 /**
4043 * Sets up.
4144 */
4245 @ BeforeClass
4346 public void setUp () {
44- MockitoAnnotations .openMocks (this );
47+ mockitoAnnotations = MockitoAnnotations .openMocks (this );
4548 configStorage = new WxCpTpDefaultConfigImpl ();
4649 when (wxCpTpService .getWxCpTpConfigStorage ()).thenReturn (configStorage );
4750 wxCpTpTagService = new WxCpTpTagServiceImpl (wxCpTpService );
4851 }
4952
53+ /**
54+ * Tear down.
55+ *
56+ * @throws Exception the exception
57+ */
58+ @ AfterClass
59+ public void tearDown () throws Exception {
60+ mockitoAnnotations .close ();
61+ }
62+
5063 /**
5164 * Test create.
5265 *
You can’t perform that action at this time.
0 commit comments