FalconSL commented on code in PR #15933:
URL: 
https://github.com/apache/dolphinscheduler/pull/15933#discussion_r1593727078


##########
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/UiPluginControllerTest.java:
##########
@@ -91,4 +103,31 @@ public void testQueryUiPluginDetailById() throws Exception {
                 
JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), 
Result.class);
         
assertThat(actualResponseContent.toString()).isEqualTo(expectResponseContent.toString());
     }
+
+    @Test
+    public void testQueryProductInfo() throws Exception {
+        ProductInfoDto mockResult = new ProductInfoDto();
+        Mockito.when(uiPluginService.queryProductInfo(Mockito.any(), 
Mockito.anyInt())).thenReturn(mockResult);
+
+        MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
+        paramsMap.add("userId", "1");
+
+        MvcResult mvcResult = 
mockMvc.perform(post("/ui-plugins/queryProductInfo")
+                        .header(SESSION_ID, sessionId)
+                        .params(paramsMap))
+                        .andExpect(status().isOk())
+                        
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
+                        .andReturn();
+
+        Result result = 
JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), 
Result.class);
+        Assertions.assertEquals(Status.SUCCESS.getCode(), 
result.getCode().intValue());
+        logger.info(mvcResult.getResponse().getContentAsString());
+    }
+
+    private User getLoginUser() {
+        User user = new User();
+        user.setId(1);
+        user.setUserName("admin");
+        return user;
+    }

Review Comment:
   > Don't add useless code
   
   Based on your proposal, I have made the following modifications:
   1. Remove the userid from the input parameter
   2. Change the query for version to selectVersion ()
   3. Remove log() and redundant methods in UT
   In addition, the queryProductInfo method in uiPluginService was submitted 
this time and there are no duplicate named methods in the project, so the 
method name has not been changed



-- 
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