3838 * @author Juergen Hoeller
3939 * @author Sam Brannen
4040 * @author Phillip Webb
41+ * @author Sebastien Deleuze
4142 */
4243class MethodParameterTests {
4344
@@ -51,19 +52,25 @@ class MethodParameterTests {
5152
5253 private MethodParameter jspecifyNullableParameter ;
5354
55+ private MethodParameter jspecifyNonNullParameter ;
56+
5457 private MethodParameter springNullableParameter ;
5558
59+ private MethodParameter springNonNullParameter ;
60+
5661
5762 @ BeforeEach
5863 void setup () throws NoSuchMethodException {
5964 method = getClass ().getMethod ("method" , String .class , long .class );
6065 stringParameter = new MethodParameter (method , 0 );
6166 longParameter = new MethodParameter (method , 1 );
6267 intReturnType = new MethodParameter (method , -1 );
63- Method jspecifyNullableMethod = getClass ().getMethod ("jspecifyNullableMethod" , String .class );
68+ Method jspecifyNullableMethod = getClass ().getMethod ("jspecifyNullableMethod" , String .class , String . class );
6469 jspecifyNullableParameter = new MethodParameter (jspecifyNullableMethod , 0 );
65- Method springNullableMethod = getClass ().getMethod ("springNullableMethod" , String .class );
70+ jspecifyNonNullParameter = new MethodParameter (jspecifyNullableMethod , 1 );
71+ Method springNullableMethod = getClass ().getMethod ("springNullableMethod" , String .class , String .class );
6672 springNullableParameter = new MethodParameter (springNullableMethod , 0 );
73+ springNonNullParameter = new MethodParameter (springNullableMethod , 1 );
6774 }
6875
6976
@@ -250,23 +257,33 @@ void jspecifyNullableParameter() {
250257 assertThat (jspecifyNullableParameter .isOptional ()).isTrue ();
251258 }
252259
260+ @ Test
261+ void jspecifyNonNullParameter () {
262+ assertThat (jspecifyNonNullParameter .isOptional ()).isFalse ();
263+ }
264+
253265 @ Test
254266 void springNullableParameter () {
255267 assertThat (springNullableParameter .isOptional ()).isTrue ();
256268 }
257269
270+ @ Test
271+ void springNonNullParameter () {
272+ assertThat (springNonNullParameter .isOptional ()).isFalse ();
273+ }
274+
258275 public int method (String p1 , long p2 ) {
259276 return 42 ;
260277 }
261278
262- public @ org .jspecify .annotations .Nullable String jspecifyNullableMethod (@ org .jspecify .annotations .Nullable String parameter ) {
263- return parameter ;
279+ public @ org .jspecify .annotations .Nullable String jspecifyNullableMethod (@ org .jspecify .annotations .Nullable String nullableParameter , String nonNullParameter ) {
280+ return nullableParameter ;
264281 }
265282
266283 @ SuppressWarnings ("deprecation" )
267284 @ org .springframework .lang .Nullable
268- public String springNullableMethod (@ org .springframework .lang .Nullable String parameter ) {
269- return parameter ;
285+ public String springNullableMethod (@ org .springframework .lang .Nullable String nullableParameter , String nonNullParameter ) {
286+ return nullableParameter ;
270287 }
271288
272289 @ SuppressWarnings ("unused" )
0 commit comments