ruanwenjun commented on code in PR #12217:
URL: https://github.com/apache/dolphinscheduler/pull/12217#discussion_r984165691


##########
dolphinscheduler-worker/src/test/java/org/apache/dolphinscheduler/server/worker/registry/WorkerRegistryClientTest.java:
##########
@@ -78,28 +79,21 @@ public class WorkerRegistryClientTest {
         // workerGroups = Sets.newHashSet(DEFAULT_WORKER_GROUP, 
TEST_WORKER_GROUP);
     }
 
-    @Before
+    @BeforeEach
     public void before() {
-        
given(workerConfig.getGroups()).willReturn(Sets.newHashSet("127.0.0.1"));
-        // 
given(heartBeatExecutor.getWorkerGroups()).willReturn(Sets.newHashSet("127.0.0.1"));
-        // scheduleAtFixedRate
-        given(heartBeatExecutor.scheduleAtFixedRate(Mockito.any(), 
Mockito.anyLong(), Mockito.anyLong(),
-                Mockito.any(TimeUnit.class))).willReturn(null);
-
     }
 
     @Test
     public void testStart() {
-        workerRegistryClient.initWorkRegistry();
-
-        given(workerManagerThread.getThreadPoolQueueSize()).willReturn(1);
-
-        given(registryClient.checkNodeExists(Mockito.anyString(), 
Mockito.any(NodeType.class))).willReturn(true);
 
+        
given(workerConfig.getWorkerAddress()).willReturn(NetUtils.getAddr(1234));
         
given(workerConfig.getHeartbeatInterval()).willReturn(Duration.ofSeconds(1));
+        given(registryClient.checkNodeExists(Mockito.anyString(), 
Mockito.any(NodeType.class))).willReturn(true);
 
+        workerRegistryClient.initWorkRegistry();
         workerRegistryClient.start();
 
+        Assertions.assertTrue(true);

Review Comment:
   Just assert success if no exception, I find if we don't contain assert, the 
Mockito will throw exception since we have mock some objects.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to