Skip to content

Commit b5f8218

Browse files
committed
Use junit5.
1 parent 16d1b2e commit b5f8218

File tree

4 files changed

+25
-26
lines changed

4 files changed

+25
-26
lines changed

dubbo-config/dubbo-config-spring/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
<dependency>
121121
<groupId>junit</groupId>
122122
<artifactId>junit</artifactId>
123+
<version>4.12</version>
123124
<scope>test</scope>
124125
</dependency>
125126
<dependency>

dubbo-dependencies-bom/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@
140140
<hessian_lite_version>3.2.5</hessian_lite_version>
141141
<swagger_version>1.5.19</swagger_version>
142142
<spring_test_version>4.3.16.RELEASE</spring_test_version>
143-
<junit_version>4.12</junit_version>
144143
<metrics_version>2.0.1</metrics_version>
145144
<sofa_registry_version>5.2.0</sofa_registry_version>
146145
<gson_version>2.8.5</gson_version>
@@ -526,11 +525,6 @@
526525
</dependency>
527526

528527
<!-- Test lib -->
529-
<dependency>
530-
<groupId>junit</groupId>
531-
<artifactId>junit</artifactId>
532-
<version>${junit_version}</version>
533-
</dependency>
534528
<dependency>
535529
<groupId>org.apache.curator</groupId>
536530
<artifactId>curator-test</artifactId>

dubbo-registry/dubbo-registry-sofa/pom.xml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,14 @@
111111
<artifactId>logback-classic</artifactId>
112112
<scope>test</scope>
113113
</dependency>
114-
115114
<dependency>
116-
<groupId>junit</groupId>
117-
<artifactId>junit</artifactId>
115+
<groupId>org.junit.jupiter</groupId>
116+
<artifactId>junit-jupiter-engine</artifactId>
117+
<scope>test</scope>
118+
</dependency>
119+
<dependency>
120+
<groupId>org.junit.jupiter</groupId>
121+
<artifactId>junit-jupiter-params</artifactId>
118122
<scope>test</scope>
119123
</dependency>
120124

dubbo-registry/dubbo-registry-sofa/src/test/java/org/apache/dubbo/registry/sofa/SofaRegistryTest.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
import org.apache.dubbo.config.ReferenceConfig;
2525
import org.apache.dubbo.config.RegistryConfig;
2626
import org.apache.dubbo.config.ServiceConfig;
27-
import org.junit.AfterClass;
28-
import org.junit.Assert;
29-
import org.junit.BeforeClass;
30-
import org.junit.Test;
27+
import org.junit.jupiter.api.AfterAll;
28+
import org.junit.jupiter.api.Assertions;
29+
import org.junit.jupiter.api.BeforeAll;
30+
import org.junit.jupiter.api.Test;
3131

3232
/**
3333
*/
@@ -45,9 +45,9 @@ public class SofaRegistryTest {
4545

4646
private static RegistryConfig registryConfig;
4747

48-
@BeforeClass
48+
@BeforeAll
4949
public static void beforeClass() {
50-
50+
5151
protocolConfig1 = new ProtocolConfig();
5252
protocolConfig1.setName("dubbo");
5353
protocolConfig1.setPort(20890);
@@ -59,7 +59,7 @@ public static void beforeClass() {
5959
registryConfig = new RegistryConfig();
6060
registryConfig.setAddress("sofa://127.0.0.1:9603");
6161
registryConfig.setProtocol("sofa");
62-
62+
6363
registryMain = new TestRegistryMain();
6464
try {
6565
registryMain.startRegistry();
@@ -79,7 +79,7 @@ public void testPubAndSub() throws InterruptedException {
7979
serviceConfig1.setGroup("g1");
8080
serviceConfig1.setApplication(applicationConfig);
8181
serviceConfig1.export();
82-
82+
8383
ServiceConfig<HelloService> serviceConfig2 = new ServiceConfig<>();
8484
serviceConfig2.setInterface(HelloService.class);
8585
serviceConfig2.setRef(new HelloServiceImpl("rrr22"));
@@ -90,8 +90,8 @@ public void testPubAndSub() throws InterruptedException {
9090
serviceConfig2.setRegister(false);
9191
serviceConfig2.export();
9292

93-
Thread.sleep(1000);
94-
93+
Thread.sleep(1000);
94+
9595
// do refer
9696
ReferenceConfig<HelloService> referenceConfig1 = new ReferenceConfig<>();
9797
referenceConfig1.setInterface(HelloService.class);
@@ -101,7 +101,7 @@ public void testPubAndSub() throws InterruptedException {
101101
referenceConfig1.setRegistry(registryConfig);
102102
referenceConfig1.setApplication(applicationConfig);
103103
HelloService service = referenceConfig1.get();
104-
Assert.assertEquals("rrr11", service.sayHello("xxx"));
104+
Assertions.assertEquals("rrr11", service.sayHello("xxx"));
105105

106106
// do refer duplicated
107107
ReferenceConfig<HelloService> referenceConfig2 = new ReferenceConfig<>();
@@ -112,7 +112,7 @@ public void testPubAndSub() throws InterruptedException {
112112
referenceConfig2.setRegistry(registryConfig);
113113
referenceConfig2.setApplication(applicationConfig);
114114
HelloService service2 = referenceConfig2.get();
115-
Assert.assertEquals("rrr11", service2.sayHello("xxx"));
115+
Assertions.assertEquals("rrr11", service2.sayHello("xxx"));
116116

117117
// export on service
118118
ServiceConfig<HelloService> serviceConfig3 = new ServiceConfig<>();
@@ -123,19 +123,19 @@ public void testPubAndSub() throws InterruptedException {
123123
serviceConfig3.setGroup("g1");
124124
serviceConfig3.setApplication(applicationConfig);
125125
serviceConfig3.export();
126-
Assert.assertTrue(service2.sayHello("xxx").startsWith("rrr1"));
126+
Assertions.assertTrue(service2.sayHello("xxx").startsWith("rrr1"));
127127

128128
// unrefer
129129
referenceConfig1.destroy();
130-
Assert.assertTrue(service2.sayHello("xxx").startsWith("rrr1"));
131-
130+
Assertions.assertTrue(service2.sayHello("xxx").startsWith("rrr1"));
131+
132132
// unexport on service
133133
serviceConfig1.unexport();
134134
Thread.sleep(2000);
135-
Assert.assertTrue(service2.sayHello("xxx").startsWith("rrr1"));
135+
Assertions.assertTrue(service2.sayHello("xxx").startsWith("rrr1"));
136136
}
137137

138-
@AfterClass
138+
@AfterAll
139139
public static void afterClass() {
140140
try {
141141
registryMain.stopRegistry();

0 commit comments

Comments
 (0)