You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2022/06/19 05:48:36 UTC
[servicecomb-java-chassis] branch master updated: [SCB-2580] migrate demo modules to junit5 (#3094)
This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git
The following commit(s) were added to refs/heads/master by this push:
new 5728e1821 [SCB-2580] migrate demo modules to junit5 (#3094)
5728e1821 is described below
commit 5728e1821d70eff4d1e44f2d093f76220d3d2fb5
Author: TingTing Wang <19...@qq.com>
AuthorDate: Sun Jun 19 13:48:31 2022 +0800
[SCB-2580] migrate demo modules to junit5 (#3094)
---
.../org/apache/servicecomb/demo/crossapp/CrossAppIT.java | 12 +++++-------
.../apache/servicecomb/demo/edge/consumer/EdgeDemoIT.java | 12 +++++-------
.../apache/servicecomb/demo/filter/retry/FilterClientIT.java | 12 +++++-------
.../test/java/org/apache/servicecomb/demo/jaxrs/JaxrsIT.java | 12 +++++-------
.../demo/localRegistryClient/LocalRegistryIT.java | 12 +++++-------
.../apache/servicecomb/demo/registry/MultiRegistriesIT.java | 12 +++++-------
.../demo/multiServiceCenterClient/MultiServiceCenterIT.java | 12 +++++-------
.../test/java/org/apache/servicecomb/demo/pojo/PojoIT.java | 12 +++++-------
.../apache/servicecomb/demo/prefix/RegisterUrlPrefixIT.java | 12 +++++-------
.../servicecomb/springboot/jaxrs/SpringBootJaxrsIT.java | 6 +++---
.../servicecomb/springboot/pojo/client/PojoClientIT.java | 12 +++++-------
.../springboot/springmvc/client/SpringmvcClientIT.java | 6 +++---
.../org/apache/servicecomb/demo/springmvc/SpringMvcIT.java | 12 +++++-------
.../demo/zeroconfig/tests/ZeroConfigRegistryIT.java | 12 +++++-------
14 files changed, 66 insertions(+), 90 deletions(-)
diff --git a/demo/demo-crossapp/crossapp-client/src/test/java/org/apache/servicecomb/demo/crossapp/CrossAppIT.java b/demo/demo-crossapp/crossapp-client/src/test/java/org/apache/servicecomb/demo/crossapp/CrossAppIT.java
index a4cf3d4b8..f1142479b 100644
--- a/demo/demo-crossapp/crossapp-client/src/test/java/org/apache/servicecomb/demo/crossapp/CrossAppIT.java
+++ b/demo/demo-crossapp/crossapp-client/src/test/java/org/apache/servicecomb/demo/crossapp/CrossAppIT.java
@@ -17,16 +17,14 @@
package org.apache.servicecomb.demo.crossapp;
-import static org.hamcrest.core.Is.is;
-
import org.apache.servicecomb.demo.TestMgr;
-import org.hamcrest.MatcherAssert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class CrossAppIT {
- @Before
+ @BeforeEach
public void setUp() throws Exception {
TestMgr.errors().clear();
}
@@ -35,6 +33,6 @@ public class CrossAppIT {
public void clientGetsNoError() throws Exception {
CrossappClient.main(new String[0]);
- MatcherAssert.assertThat(TestMgr.errors().isEmpty(), is(true));
+ Assertions.assertTrue(TestMgr.errors().isEmpty());
}
}
diff --git a/demo/demo-edge/consumer/src/test/java/org/apache/servicecomb/demo/edge/consumer/EdgeDemoIT.java b/demo/demo-edge/consumer/src/test/java/org/apache/servicecomb/demo/edge/consumer/EdgeDemoIT.java
index ee11e0ab0..8b5add109 100644
--- a/demo/demo-edge/consumer/src/test/java/org/apache/servicecomb/demo/edge/consumer/EdgeDemoIT.java
+++ b/demo/demo-edge/consumer/src/test/java/org/apache/servicecomb/demo/edge/consumer/EdgeDemoIT.java
@@ -17,15 +17,13 @@
package org.apache.servicecomb.demo.edge.consumer;
-import static org.hamcrest.core.Is.is;
-
import org.apache.servicecomb.demo.TestMgr;
-import org.hamcrest.MatcherAssert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class EdgeDemoIT {
- @Before
+ @BeforeEach
public void setUp() {
TestMgr.errors().clear();
}
@@ -34,6 +32,6 @@ public class EdgeDemoIT {
public void clientGetsNoError() throws Exception {
ConsumerMain.main(new String[0]);
- MatcherAssert.assertThat(TestMgr.errors().isEmpty(), is(true));
+ Assertions.assertTrue(TestMgr.errors().isEmpty());
}
}
diff --git a/demo/demo-filter/filter-client/src/test/java/org/apache/servicecomb/demo/filter/retry/FilterClientIT.java b/demo/demo-filter/filter-client/src/test/java/org/apache/servicecomb/demo/filter/retry/FilterClientIT.java
index cbdb70a80..0f332eec6 100644
--- a/demo/demo-filter/filter-client/src/test/java/org/apache/servicecomb/demo/filter/retry/FilterClientIT.java
+++ b/demo/demo-filter/filter-client/src/test/java/org/apache/servicecomb/demo/filter/retry/FilterClientIT.java
@@ -17,17 +17,15 @@
package org.apache.servicecomb.demo.filter.retry;
-import static org.hamcrest.core.Is.is;
-
import org.apache.servicecomb.demo.TestMgr;
import org.apache.servicecomb.demo.filter.FilterClient;
-import org.hamcrest.MatcherAssert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class FilterClientIT {
- @Before
+ @BeforeEach
public void setUp() {
TestMgr.errors().clear();
}
@@ -36,6 +34,6 @@ public class FilterClientIT {
public void clientGetsNoError() throws Exception {
FilterClient.main(new String[0]);
- MatcherAssert.assertThat(TestMgr.errors().isEmpty(), is(true));
+ Assertions.assertTrue(TestMgr.errors().isEmpty());
}
}
diff --git a/demo/demo-jaxrs/jaxrs-client/src/test/java/org/apache/servicecomb/demo/jaxrs/JaxrsIT.java b/demo/demo-jaxrs/jaxrs-client/src/test/java/org/apache/servicecomb/demo/jaxrs/JaxrsIT.java
index 91cf268ce..aaf2ea127 100644
--- a/demo/demo-jaxrs/jaxrs-client/src/test/java/org/apache/servicecomb/demo/jaxrs/JaxrsIT.java
+++ b/demo/demo-jaxrs/jaxrs-client/src/test/java/org/apache/servicecomb/demo/jaxrs/JaxrsIT.java
@@ -17,16 +17,14 @@
package org.apache.servicecomb.demo.jaxrs;
-import static org.hamcrest.core.Is.is;
-
import org.apache.servicecomb.demo.TestMgr;
-import org.hamcrest.MatcherAssert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class JaxrsIT {
- @Before
+ @BeforeEach
public void setUp() {
TestMgr.errors().clear();
}
@@ -35,6 +33,6 @@ public class JaxrsIT {
public void clientGetsNoError() throws Exception {
JaxrsClient.main(new String[0]);
- MatcherAssert.assertThat(TestMgr.errors().isEmpty(), is(true));
+ Assertions.assertTrue(TestMgr.errors().isEmpty());
}
}
diff --git a/demo/demo-local-registry/demo-local-registry-client/src/test/java/org/apache/servicecomb/demo/localRegistryClient/LocalRegistryIT.java b/demo/demo-local-registry/demo-local-registry-client/src/test/java/org/apache/servicecomb/demo/localRegistryClient/LocalRegistryIT.java
index d1798355e..6157da6d3 100644
--- a/demo/demo-local-registry/demo-local-registry-client/src/test/java/org/apache/servicecomb/demo/localRegistryClient/LocalRegistryIT.java
+++ b/demo/demo-local-registry/demo-local-registry-client/src/test/java/org/apache/servicecomb/demo/localRegistryClient/LocalRegistryIT.java
@@ -17,15 +17,13 @@
package org.apache.servicecomb.demo.localRegistryClient;
-import static org.hamcrest.core.Is.is;
-
import org.apache.servicecomb.demo.TestMgr;
-import org.hamcrest.MatcherAssert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class LocalRegistryIT {
- @Before
+ @BeforeEach
public void setUp() throws Exception {
TestMgr.errors().clear();
}
@@ -34,6 +32,6 @@ public class LocalRegistryIT {
public void clientGetsNoError() throws Exception {
Application.main(new String[0]);
- MatcherAssert.assertThat(TestMgr.errors().isEmpty(), is(true));
+ Assertions.assertTrue(TestMgr.errors().isEmpty());
}
}
diff --git a/demo/demo-multi-registries/demo-multi-registries-client/src/test/java/org/apache/servicecomb/demo/registry/MultiRegistriesIT.java b/demo/demo-multi-registries/demo-multi-registries-client/src/test/java/org/apache/servicecomb/demo/registry/MultiRegistriesIT.java
index edf557d66..87588ddea 100644
--- a/demo/demo-multi-registries/demo-multi-registries-client/src/test/java/org/apache/servicecomb/demo/registry/MultiRegistriesIT.java
+++ b/demo/demo-multi-registries/demo-multi-registries-client/src/test/java/org/apache/servicecomb/demo/registry/MultiRegistriesIT.java
@@ -17,15 +17,13 @@
package org.apache.servicecomb.demo.registry;
-import static org.hamcrest.core.Is.is;
-
import org.apache.servicecomb.demo.TestMgr;
-import org.hamcrest.MatcherAssert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class MultiRegistriesIT {
- @Before
+ @BeforeEach
public void setUp() throws Exception {
TestMgr.errors().clear();
}
@@ -34,6 +32,6 @@ public class MultiRegistriesIT {
public void clientGetsNoError() throws Exception {
Application.main(new String[0]);
- MatcherAssert.assertThat(TestMgr.errors().isEmpty(), is(true));
+ Assertions.assertTrue(TestMgr.errors().isEmpty());
}
}
diff --git a/demo/demo-multi-service-center/demo-multi-service-center-client/src/test/java/org/apache/servicecomb/demo/multiServiceCenterClient/MultiServiceCenterIT.java b/demo/demo-multi-service-center/demo-multi-service-center-client/src/test/java/org/apache/servicecomb/demo/multiServiceCenterClient/MultiServiceCenterIT.java
index 9155234c7..f7cd51571 100644
--- a/demo/demo-multi-service-center/demo-multi-service-center-client/src/test/java/org/apache/servicecomb/demo/multiServiceCenterClient/MultiServiceCenterIT.java
+++ b/demo/demo-multi-service-center/demo-multi-service-center-client/src/test/java/org/apache/servicecomb/demo/multiServiceCenterClient/MultiServiceCenterIT.java
@@ -17,15 +17,13 @@
package org.apache.servicecomb.demo.multiServiceCenterClient;
-import static org.hamcrest.core.Is.is;
-
import org.apache.servicecomb.demo.TestMgr;
-import org.hamcrest.MatcherAssert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class MultiServiceCenterIT {
- @Before
+ @BeforeEach
public void setUp() throws Exception {
TestMgr.errors().clear();
}
@@ -34,6 +32,6 @@ public class MultiServiceCenterIT {
public void clientGetsNoError() throws Exception {
Application.main(new String[0]);
- MatcherAssert.assertThat(TestMgr.errors().isEmpty(), is(true));
+ Assertions.assertTrue(TestMgr.errors().isEmpty());
}
}
diff --git a/demo/demo-pojo/pojo-client/src/test/java/org/apache/servicecomb/demo/pojo/PojoIT.java b/demo/demo-pojo/pojo-client/src/test/java/org/apache/servicecomb/demo/pojo/PojoIT.java
index 715652df9..0f3101b25 100644
--- a/demo/demo-pojo/pojo-client/src/test/java/org/apache/servicecomb/demo/pojo/PojoIT.java
+++ b/demo/demo-pojo/pojo-client/src/test/java/org/apache/servicecomb/demo/pojo/PojoIT.java
@@ -17,17 +17,15 @@
package org.apache.servicecomb.demo.pojo;
-import static org.hamcrest.core.Is.is;
-
import org.apache.servicecomb.demo.TestMgr;
import org.apache.servicecomb.demo.pojo.client.PojoClient;
-import org.hamcrest.MatcherAssert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class PojoIT {
- @Before
+ @BeforeEach
public void setUp() throws Exception {
TestMgr.errors().clear();
}
@@ -36,6 +34,6 @@ public class PojoIT {
public void clientGetsNoError() throws Exception {
PojoClient.main(new String[0]);
- MatcherAssert.assertThat(TestMgr.errors().isEmpty(), is(true));
+ Assertions.assertTrue(TestMgr.errors().isEmpty());
}
}
diff --git a/demo/demo-register-url-prefix/demo-register-url-prefix-client/src/test/java/org/apache/servicecomb/demo/prefix/RegisterUrlPrefixIT.java b/demo/demo-register-url-prefix/demo-register-url-prefix-client/src/test/java/org/apache/servicecomb/demo/prefix/RegisterUrlPrefixIT.java
index b82c03928..e4ae70fad 100644
--- a/demo/demo-register-url-prefix/demo-register-url-prefix-client/src/test/java/org/apache/servicecomb/demo/prefix/RegisterUrlPrefixIT.java
+++ b/demo/demo-register-url-prefix/demo-register-url-prefix-client/src/test/java/org/apache/servicecomb/demo/prefix/RegisterUrlPrefixIT.java
@@ -17,16 +17,14 @@
package org.apache.servicecomb.demo.prefix;
-import static org.hamcrest.core.Is.is;
-
import org.apache.servicecomb.demo.TestMgr;
-import org.hamcrest.MatcherAssert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.springframework.boot.SpringApplication;
public class RegisterUrlPrefixIT {
- @Before
+ @BeforeEach
public void setUp() throws Exception {
TestMgr.errors().clear();
}
@@ -37,6 +35,6 @@ public class RegisterUrlPrefixIT {
Application.runTest();
- MatcherAssert.assertThat(TestMgr.errors().isEmpty(), is(true));
+ Assertions.assertTrue(TestMgr.errors().isEmpty());
}
}
diff --git a/demo/demo-spring-boot-provider/demo-spring-boot-jaxrs-client/src/test/java/org/apache/servicecomb/springboot/jaxrs/SpringBootJaxrsIT.java b/demo/demo-spring-boot-provider/demo-spring-boot-jaxrs-client/src/test/java/org/apache/servicecomb/springboot/jaxrs/SpringBootJaxrsIT.java
index d5152c98f..283b39dad 100644
--- a/demo/demo-spring-boot-provider/demo-spring-boot-jaxrs-client/src/test/java/org/apache/servicecomb/springboot/jaxrs/SpringBootJaxrsIT.java
+++ b/demo/demo-spring-boot-provider/demo-spring-boot-jaxrs-client/src/test/java/org/apache/servicecomb/springboot/jaxrs/SpringBootJaxrsIT.java
@@ -19,13 +19,13 @@ package org.apache.servicecomb.springboot.jaxrs;
import org.apache.servicecomb.demo.TestMgr;
import org.apache.servicecomb.springboot.jaxrs.client.JaxrsClient;
-import org.junit.Before;
-import org.junit.Test;
import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class SpringBootJaxrsIT {
- @Before
+ @BeforeEach
public void setUp() throws Exception {
TestMgr.errors().clear();
}
diff --git a/demo/demo-spring-boot-transport/demo-spring-boot-pojo-client/src/test/java/org/apache/servicecomb/springboot/pojo/client/PojoClientIT.java b/demo/demo-spring-boot-transport/demo-spring-boot-pojo-client/src/test/java/org/apache/servicecomb/springboot/pojo/client/PojoClientIT.java
index d3ba72539..befe5a008 100644
--- a/demo/demo-spring-boot-transport/demo-spring-boot-pojo-client/src/test/java/org/apache/servicecomb/springboot/pojo/client/PojoClientIT.java
+++ b/demo/demo-spring-boot-transport/demo-spring-boot-pojo-client/src/test/java/org/apache/servicecomb/springboot/pojo/client/PojoClientIT.java
@@ -17,17 +17,15 @@
package org.apache.servicecomb.springboot.pojo.client;
-import static org.hamcrest.core.Is.is;
-
import org.apache.servicecomb.demo.TestMgr;
-import org.hamcrest.MatcherAssert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.springframework.boot.SpringApplication;
public class PojoClientIT {
- @Before
+ @BeforeEach
public void setUp() throws Exception {
TestMgr.errors().clear();
}
@@ -36,6 +34,6 @@ public class PojoClientIT {
public void clientGetsNoError() throws Exception {
SpringApplication.run(PojoClient.class);
- MatcherAssert.assertThat(TestMgr.errors().isEmpty(), is(true));
+ Assertions.assertTrue(TestMgr.errors().isEmpty());
}
}
diff --git a/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-client/src/test/java/org/apache/servicecomb/springboot/springmvc/client/SpringmvcClientIT.java b/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-client/src/test/java/org/apache/servicecomb/springboot/springmvc/client/SpringmvcClientIT.java
index 661c8384a..9e254066e 100644
--- a/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-client/src/test/java/org/apache/servicecomb/springboot/springmvc/client/SpringmvcClientIT.java
+++ b/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-client/src/test/java/org/apache/servicecomb/springboot/springmvc/client/SpringmvcClientIT.java
@@ -18,12 +18,12 @@
package org.apache.servicecomb.springboot.springmvc.client;
import org.apache.servicecomb.demo.TestMgr;
-import org.junit.Before;
-import org.junit.Test;
import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class SpringmvcClientIT {
- @Before
+ @BeforeEach
public void setUp() throws Exception {
TestMgr.errors().clear();
}
diff --git a/demo/demo-springmvc/springmvc-client/src/test/java/org/apache/servicecomb/demo/springmvc/SpringMvcIT.java b/demo/demo-springmvc/springmvc-client/src/test/java/org/apache/servicecomb/demo/springmvc/SpringMvcIT.java
index 0591a9af3..414273ab9 100644
--- a/demo/demo-springmvc/springmvc-client/src/test/java/org/apache/servicecomb/demo/springmvc/SpringMvcIT.java
+++ b/demo/demo-springmvc/springmvc-client/src/test/java/org/apache/servicecomb/demo/springmvc/SpringMvcIT.java
@@ -17,16 +17,14 @@
package org.apache.servicecomb.demo.springmvc;
-import static org.hamcrest.core.Is.is;
-
import org.apache.servicecomb.demo.TestMgr;
-import org.hamcrest.MatcherAssert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class SpringMvcIT {
- @Before
+ @BeforeEach
public void setUp() {
TestMgr.errors().clear();
}
@@ -35,6 +33,6 @@ public class SpringMvcIT {
public void clientGetsNoError() throws Exception {
SpringmvcClient.main(new String[0]);
- MatcherAssert.assertThat(TestMgr.errors().isEmpty(), is(true));
+ Assertions.assertTrue(TestMgr.errors().isEmpty());
}
}
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/test/java/org/apache/servicecomb/demo/zeroconfig/tests/ZeroConfigRegistryIT.java b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/test/java/org/apache/servicecomb/demo/zeroconfig/tests/ZeroConfigRegistryIT.java
index ce07a1116..cd531243e 100644
--- a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/test/java/org/apache/servicecomb/demo/zeroconfig/tests/ZeroConfigRegistryIT.java
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/test/java/org/apache/servicecomb/demo/zeroconfig/tests/ZeroConfigRegistryIT.java
@@ -18,15 +18,13 @@
package org.apache.servicecomb.demo.zeroconfig.tests;
-import static org.hamcrest.core.Is.is;
-
import org.apache.servicecomb.demo.TestMgr;
-import org.hamcrest.MatcherAssert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ZeroConfigRegistryIT {
- @Before
+ @BeforeEach
public void setUp() throws Exception {
TestMgr.errors().clear();
}
@@ -35,6 +33,6 @@ public class ZeroConfigRegistryIT {
public void clientGetsNoError() throws Exception {
Application.main(new String[0]);
- MatcherAssert.assertThat(TestMgr.errors().isEmpty(), is(true));
+ Assertions.assertTrue(TestMgr.errors().isEmpty());
}
}