You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/10/11 01:44:13 UTC

[GitHub] [dolphinscheduler] kezhenxu94 commented on a diff in pull request #12299: [Improvement][Test] Migrate all UT cases from jUnit4 to jUnit5 in task-plugin module as an example

kezhenxu94 commented on code in PR #12299:
URL: https://github.com/apache/dolphinscheduler/pull/12299#discussion_r991744636


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-sagemaker/src/test/java/org/apache/dolphinscheduler/plugin/task/sagemaker/SagemakerTaskTest.java:
##########
@@ -60,35 +60,37 @@
         sagemakerTask.init();
 
         StartPipelineExecutionResult startPipelineExecutionResult = Mockito.mock(StartPipelineExecutionResult.class);
-        Mockito.when(startPipelineExecutionResult.getPipelineExecutionArn()).thenReturn(pipelineExecutionArn);
+        Mockito.lenient().when(startPipelineExecutionResult.getPipelineExecutionArn()).thenReturn(pipelineExecutionArn);
 
         StopPipelineExecutionResult stopPipelineExecutionResult = Mockito.mock(StopPipelineExecutionResult.class);
-        Mockito.when(stopPipelineExecutionResult.getPipelineExecutionArn()).thenReturn(pipelineExecutionArn);
+        Mockito.lenient().when(stopPipelineExecutionResult.getPipelineExecutionArn()).thenReturn(pipelineExecutionArn);
 
-        DescribePipelineExecutionResult describePipelineExecutionResult = Mockito.mock(DescribePipelineExecutionResult.class);
-        Mockito.when(describePipelineExecutionResult.getPipelineExecutionStatus()).thenReturn("Executing", "Succeeded");
+        DescribePipelineExecutionResult describePipelineExecutionResult =
+                Mockito.mock(DescribePipelineExecutionResult.class);
+        Mockito.lenient().when(describePipelineExecutionResult.getPipelineExecutionStatus()).thenReturn("Executing",
+                "Succeeded");
 
-        Mockito.when(client.startPipelineExecution(any())).thenReturn(startPipelineExecutionResult);
-        Mockito.when(client.stopPipelineExecution(any())).thenReturn(stopPipelineExecutionResult);
-        Mockito.when(client.describePipelineExecution(any())).thenReturn(describePipelineExecutionResult);
+        Mockito.lenient().when(client.startPipelineExecution(any())).thenReturn(startPipelineExecutionResult);
+        Mockito.lenient().when(client.stopPipelineExecution(any())).thenReturn(stopPipelineExecutionResult);
+        Mockito.lenient().when(client.describePipelineExecution(any())).thenReturn(describePipelineExecutionResult);
     }
 
     @Test
     public void testStartPipelineRequest() throws Exception {
         StartPipelineExecutionRequest request = sagemakerTask.createStartPipelineRequest();
-        Assert.assertEquals("AbalonePipeline", request.getPipelineName());
-        Assert.assertEquals("test Pipeline", request.getPipelineExecutionDescription());
-        Assert.assertEquals("AbalonePipeline", request.getPipelineExecutionDisplayName());
-        Assert.assertEquals("AbalonePipeline", request.getPipelineName());
-        Assert.assertEquals(new Integer(1), request.getParallelismConfiguration().getMaxParallelExecutionSteps());
+        Assertions.assertEquals("AbalonePipeline", request.getPipelineName());
+        Assertions.assertEquals("test Pipeline", request.getPipelineExecutionDescription());
+        Assertions.assertEquals("AbalonePipeline", request.getPipelineExecutionDisplayName());
+        Assertions.assertEquals("AbalonePipeline", request.getPipelineName());
+        Assertions.assertEquals(new Integer(1), request.getParallelismConfiguration().getMaxParallelExecutionSteps());

Review Comment:
   @EricGao888 take a look at this



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org