|
18 | 18 |
|
19 | 19 | import java.lang.reflect.Method;
|
20 | 20 |
|
| 21 | +import org.jspecify.annotations.Nullable; |
21 | 22 | import org.junit.jupiter.api.BeforeEach;
|
22 | 23 | import org.junit.jupiter.api.Test;
|
23 | 24 |
|
24 | 25 | import org.springframework.core.MethodParameter;
|
25 | 26 | import org.springframework.web.bind.support.WebDataBinderFactory;
|
26 | 27 | import org.springframework.web.context.request.NativeWebRequest;
|
27 | 28 | import org.springframework.web.context.request.ServletWebRequest;
|
| 29 | +import org.springframework.web.method.HandlerMethod; |
28 | 30 | import org.springframework.web.testfixture.method.ResolvableMethod;
|
29 | 31 | import org.springframework.web.testfixture.servlet.MockHttpServletRequest;
|
30 | 32 | import org.springframework.web.testfixture.servlet.MockHttpServletResponse;
|
@@ -105,6 +107,14 @@ void resolveProvidedArgFirst() throws Exception {
|
105 | 107 | assertThat(value).isEqualTo("2-value2");
|
106 | 108 | }
|
107 | 109 |
|
| 110 | + @Test |
| 111 | + void resolveHandlerMethodArgToNull() throws Exception { |
| 112 | + Object value = getInvocable(HandlerMethod.class).invokeForRequest(request, null); |
| 113 | + |
| 114 | + assertThat(value).isNotNull(); |
| 115 | + assertThat(value).isEqualTo("success"); |
| 116 | + } |
| 117 | + |
108 | 118 | @Test
|
109 | 119 | void exceptionInResolvingArg() {
|
110 | 120 | this.composite.addResolver(new ExceptionRaisingArgumentResolver());
|
@@ -184,6 +194,10 @@ public void handle(double amount) {
|
184 | 194 | public void handleWithException(Throwable ex) throws Throwable {
|
185 | 195 | throw ex;
|
186 | 196 | }
|
| 197 | + |
| 198 | + public String handleHandlerMethod(@Nullable HandlerMethod handlerMethod) { |
| 199 | + return "success"; |
| 200 | + } |
187 | 201 | }
|
188 | 202 |
|
189 | 203 |
|
|
0 commit comments