1717
1818package org .apache .rocketmq .client .impl .mqclient ;
1919
20- import static org .junit .jupiter .api .Assertions .assertEquals ;
21- import static org .junit .jupiter .api .Assertions .assertThrows ;
20+ import static org .junit .Assert .assertEquals ;
21+ import static org .junit .Assert .assertThrows ;
22+ import static org .junit .Assert .assertTrue ;
2223
2324import java .util .List ;
2425import java .util .concurrent .ScheduledExecutorService ;
2728import org .apache .rocketmq .common .MixAll ;
2829import org .apache .rocketmq .common .utils .ThreadUtils ;
2930import org .apache .rocketmq .remoting .RPCHook ;
30- import org .junit .jupiter . api . AfterEach ;
31- import org .junit .jupiter . api . BeforeEach ;
32- import org .junit .jupiter . api . Test ;
31+ import org .junit .After ;
32+ import org .junit .Before ;
33+ import org .junit .Test ;
3334
34- class MQClientAPITest {
35+ public class MQClientAPITest {
3536
3637 private NameserverAccessConfig nameserverAccessConfig ;
3738 private final ClientRemotingProcessor clientRemotingProcessor = new DoNothingClientRemotingProcessor (null );
3839 private final RPCHook rpcHook = null ;
3940 private ScheduledExecutorService scheduledExecutorService ;
4041 private MQClientAPIFactory mqClientAPIFactory ;
4142
42- @ BeforeEach
43- void setUp () {
43+ @ Before
44+ public void setUp () {
4445 scheduledExecutorService = ThreadUtils .newSingleThreadScheduledExecutor ("TestScheduledExecutorService" , true );
4546 }
4647
47- @ AfterEach
48+ @ After
4849 public void tearDown () {
4950 scheduledExecutorService .shutdownNow ();
5051 }
5152
5253 @ Test
53- void testInitWithNamesrvAddr () {
54+ public void testInitWithNamesrvAddr () {
5455 nameserverAccessConfig = new NameserverAccessConfig ("127.0.0.1:9876" , "" , "" );
5556
5657 mqClientAPIFactory = new MQClientAPIFactory (
@@ -66,7 +67,7 @@ void testInitWithNamesrvAddr() {
6667 }
6768
6869 @ Test
69- void testInitWithNamesrvDomain () {
70+ public void testInitWithNamesrvDomain () {
7071 nameserverAccessConfig = new NameserverAccessConfig ("" , "test-domain" , "" );
7172
7273 mqClientAPIFactory = new MQClientAPIFactory (
@@ -82,7 +83,7 @@ void testInitWithNamesrvDomain() {
8283 }
8384
8485 @ Test
85- void testInitThrowsExceptionWhenBothEmpty () {
86+ public void testInitThrowsExceptionWhenBothEmpty () {
8687 nameserverAccessConfig = new NameserverAccessConfig ("" , "" , "" );
8788
8889 RuntimeException exception = assertThrows (RuntimeException .class , () -> new MQClientAPIFactory (
@@ -98,7 +99,7 @@ void testInitThrowsExceptionWhenBothEmpty() {
9899 }
99100
100101 @ Test
101- void testStartCreatesClients () throws Exception {
102+ public void testStartCreatesClients () throws Exception {
102103 nameserverAccessConfig = new NameserverAccessConfig ("127.0.0.1:9876" , "" , "" );
103104
104105 mqClientAPIFactory = new MQClientAPIFactory (
@@ -122,7 +123,7 @@ void testStartCreatesClients() throws Exception {
122123 }
123124
124125 @ Test
125- void testOnNameServerAddressChangeUpdatesAllClients () throws Exception {
126+ public void testOnNameServerAddressChangeUpdatesAllClients () throws Exception {
126127 nameserverAccessConfig = new NameserverAccessConfig ("127.0.0.1:9876" , "" , "" );
127128
128129 mqClientAPIFactory = new MQClientAPIFactory (
@@ -141,6 +142,6 @@ void testOnNameServerAddressChangeUpdatesAllClients() throws Exception {
141142 MQClientAPIExt client = mqClientAPIFactory .getClient ();
142143 List <String > nameServerAddressList = client .getNameServerAddressList ();
143144 assertEquals (2 , nameServerAddressList .size ());
144- assertEquals ( "new-address0" , nameServerAddressList . get ( 0 ));
145+ assertTrue ( nameServerAddressList . contains ( "new-address0" ));
145146 }
146147}
0 commit comments