Add method validation to Spring MVC
See gh-29825
This commit is contained in:
committed by
rstoyanchev
parent
cb04c3b335
commit
bd054a4918
@@ -60,7 +60,7 @@ class ModelAttributeMethodProcessorKotlinTests {
|
||||
val mockRequest = MockHttpServletRequest().apply { addParameter("a", "b") }
|
||||
val requestWithParam = ServletWebRequest(mockRequest)
|
||||
val factory = mock<WebDataBinderFactory>()
|
||||
given(factory.createBinder(any(), any(), eq("param")))
|
||||
given(factory.createBinder(any(), any(), eq("param"), any()))
|
||||
.willAnswer { WebRequestDataBinder(it.getArgument(1)) }
|
||||
assertThat(processor.resolveArgument(this.param, container, requestWithParam, factory)).isEqualTo(Param("b"))
|
||||
}
|
||||
@@ -70,7 +70,7 @@ class ModelAttributeMethodProcessorKotlinTests {
|
||||
val mockRequest = MockHttpServletRequest().apply { addParameter("a", null) }
|
||||
val requestWithParam = ServletWebRequest(mockRequest)
|
||||
val factory = mock<WebDataBinderFactory>()
|
||||
given(factory.createBinder(any(), any(), eq("param")))
|
||||
given(factory.createBinder(any(), any(), eq("param"), any()))
|
||||
.willAnswer { WebRequestDataBinder(it.getArgument(1)) }
|
||||
assertThatThrownBy {
|
||||
processor.resolveArgument(this.param, container, requestWithParam, factory)
|
||||
|
||||
Reference in New Issue
Block a user