Closed spring-projects-issues closed 6 years ago
Juergen Hoeller commented
I'm afraid this is not a bug report but rather a question for a forum or for StackOverflow. Please only report actual framework issues or improvement requests here, ideally tested against the most recent version.
Akhila opened SPR-16370 and commented
Controller Method:
@RequestMapping
(value = "/eligibleAccounts", method = RequestMethod.POST) public ModelMap reguGetEligibleAccounts(@RequestBody
@Valid
AccountTypeRequest request, BindingResult bindingResult, HttpServletRequest servReq, ModelMap modelMap) {For this controller method, I have to write Junit. I have written like:
@Test
public void testReguEligigbleAccounts() { byte[] jsonContent = loadJson("classpath:/config/mock/eligibleAccount.json");Error: Failed tests: ReguControllerTest.testReguEligigbleAccounts:190 annotationMethodHandlerAdapter.handle() throws an exception: org.springframework.web.bind.annotation.support.HandlerMethodInvocationException: Failed to invoke handler method [public org.springframework.ui.ModelMap com.etrade.neo.regu.controller.ReguController.reguGetEligibleAccounts(com.etrade.neo.regu.request.AccountTypeRequest,org.springframework.validation.BindingResult,javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap)]; nested exception is java.lang.IllegalStateException: Errors/BindingResult argument declared without preceding model attribute. Check your handler method signature! expected null, but was:<org.springframework.web.bind.annotation.support.HandlerMethodInvocationException: Failed to invoke handler method [public org.springframework.ui.ModelMap com.etrade.neo.regu.controller.ReguController.reguGetEligibleAccounts(com.etrade.neo.regu.request.AccountTypeRequest,org.springframework.validation.BindingResult,javax.servlet.http.HttpServletRequest,org.springframework.ui.ModelMap)]; nested exception is java.lang.IllegalStateException: Errors/BindingResult argument declared without preceding model attribute. Check your handler method signature!>
No further details from SPR-16370