You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by xi...@apache.org on 2022/07/01 12:35:31 UTC
[incubator-shenyu] branch master updated: [ISSUE 3643] PluginHandleControllerTest.testQueryPluginHandles throw MissingServletRequestParameterException (#3644)
This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 6cc0b6b8f [ISSUE 3643] PluginHandleControllerTest.testQueryPluginHandles throw MissingServletRequestParameterException (#3644)
6cc0b6b8f is described below
commit 6cc0b6b8f52c06b154c00699c65579db1277be7e
Author: haibo.duan <dh...@live.cn>
AuthorDate: Fri Jul 1 20:35:25 2022 +0800
[ISSUE 3643] PluginHandleControllerTest.testQueryPluginHandles throw MissingServletRequestParameterException (#3644)
* Fix #3643 PluginHandleControllerTest.testQueryPluginHandles throw MissingServletRequestParameterException
* checkstyle
* recovery code
---
.../admin/controller/PluginHandleControllerTest.java | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/PluginHandleControllerTest.java b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/PluginHandleControllerTest.java
index 6ba676571..aca0cfe13 100644
--- a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/PluginHandleControllerTest.java
+++ b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/PluginHandleControllerTest.java
@@ -65,7 +65,7 @@ public final class PluginHandleControllerTest {
@Mock
private PluginHandleService pluginHandleService;
-
+
@Mock
private PluginHandleMapper handleMapper;
@@ -84,7 +84,9 @@ public final class PluginHandleControllerTest {
public void testQueryPluginHandles() throws Exception {
given(this.pluginHandleService.listByPage(new PluginHandleQuery("2", null, null, new PageParameter(1, 1))))
.willReturn(new CommonPager<>());
- this.mockMvc.perform(MockMvcRequestBuilders.get("/plugin-handle/", "1", 1, 1))
+ this.mockMvc.perform(MockMvcRequestBuilders.get("/plugin-handle")
+ .param("currentPage", "1")
+ .param("pageSize", "1"))
.andExpect(status().isOk())
.andReturn();
}
@@ -117,8 +119,8 @@ public final class PluginHandleControllerTest {
pluginHandleDTO.setField("f");
given(this.pluginHandleService.createOrUpdate(pluginHandleDTO)).willReturn(1);
this.mockMvc.perform(MockMvcRequestBuilders.post("/plugin-handle/")
- .contentType(MediaType.APPLICATION_JSON)
- .content(GsonUtils.getInstance().toJson(pluginHandleDTO)))
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(GsonUtils.getInstance().toJson(pluginHandleDTO)))
.andExpect(status().isOk())
.andExpect(jsonPath("$.message", is(ShenyuResultMessage.CREATE_SUCCESS)))
.andReturn();
@@ -136,8 +138,8 @@ public final class PluginHandleControllerTest {
when(handleMapper.existed(pluginHandleDTO.getId())).thenReturn(true);
given(this.pluginHandleService.createOrUpdate(pluginHandleDTO)).willReturn(1);
this.mockMvc.perform(MockMvcRequestBuilders.put("/plugin-handle/{id}", "1")
- .contentType(MediaType.APPLICATION_JSON)
- .content(GsonUtils.getInstance().toJson(pluginHandleDTO)))
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(GsonUtils.getInstance().toJson(pluginHandleDTO)))
.andExpect(status().isOk())
.andExpect(jsonPath("$.message", is(ShenyuResultMessage.UPDATE_SUCCESS)))
.andReturn();
@@ -147,8 +149,8 @@ public final class PluginHandleControllerTest {
public void testDeletePluginHandles() throws Exception {
given(this.pluginHandleService.deletePluginHandles(Collections.singletonList("1"))).willReturn(1);
this.mockMvc.perform(MockMvcRequestBuilders.delete("/plugin-handle/batch", "1")
- .contentType(MediaType.APPLICATION_JSON)
- .content(GsonUtils.getInstance().toJson(Collections.singletonList("1"))))
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(GsonUtils.getInstance().toJson(Collections.singletonList("1"))))
.andExpect(status().isOk())
.andExpect(jsonPath("$.message", is(ShenyuResultMessage.DELETE_SUCCESS)))
.andReturn();