This is my Junit Test class
@Before
public void setup() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
RestGatewaySupport gateway = new RestGatewaySupport();
gateway.setRestTemplate(restTemplate);
mockServer = MockRestServiceServer.createServer(gateway);
}
@Test
public void test_findFileActFileSearch_success() throws Exception{
String inputUrl = "/hel/hel/xyz/xyzsearch";
FileActSearchParams mockFileActSearchParams = new FileActSearchParams();
mockFileActSearchParams.setGrpHeaderMsgId("xyz");
mockFileActSearchParams.setMsgUsrRefFileAct("abcs");
mockMvc.perform(get(inputUrl)
.flashAttr("params", mockFileActSearchParams)).andDo(print()).andExpect(status().isOk())
.andExpect(view().name("ajaxSearchFileResponse"))
.andExpect(model().attributeExists("arg")); mockServer.verify();
}
I am getting below exception
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.AssertionError: No further requests expected: HTTP GET http://localhost:9966/hello?
0 request(s) executed.
此测试用例用于一个内部调用API的带有MVC注释的Controller。 API从邮递员那里正常工作。但是从Test类中,它给出了以下异常
java.lang.AssertionError的原因是什么
我需要HLP。预先感谢