2222
2323import org .junit .jupiter .api .Test ;
2424import org .mockito .Mockito ;
25-
2625import org .springframework .data .core .TypeInformation ;
2726import org .springframework .data .domain .Pageable ;
2827import org .springframework .data .repository .core .RepositoryInformation ;
2928import org .springframework .data .repository .query .Param ;
29+ import org .springframework .data .web .SortDefault ;
3030import org .springframework .javapoet .ParameterSpec ;
3131
3232/**
3333 * Unit tests for {@link MethodMetadata}.
3434 *
3535 * @author Christoph Strobl
36+ * @author Mark Paluch
3637 */
3738class MethodMetadataUnitTests {
3839
@@ -51,8 +52,13 @@ void addsAnnotations() throws NoSuchMethodException {
5152
5253 MethodMetadata metadata = methodMetadataFor ("threeArgsMethod" );
5354
54- ParameterSpec spec = metadata .getMethodArguments ().get ("arg2" );
55- assertThat (spec .annotations ()).hasSize (1 );
55+ ParameterSpec arg1 = metadata .getMethodArguments ().get ("arg1" );
56+ assertThat (arg1 .annotations ()).extracting (annotationSpec -> annotationSpec .type ().toString ())
57+ .containsExactly (SortDefault .class .getTypeName ());
58+
59+ ParameterSpec arg2 = metadata .getMethodArguments ().get ("arg2" );
60+ assertThat (arg2 .annotations ()).extracting (annotationSpec -> annotationSpec .type ().toString ())
61+ .containsExactly (SortDefault .class .getTypeName (), Param .class .getTypeName ());
5662 }
5763
5864 @ Test // GH-3270
@@ -93,6 +99,6 @@ private interface DummyRepo {
9399
94100 String noArgsMethod ();
95101
96- String threeArgsMethod (Object arg0 , Pageable arg1 , @ Param ("foo" ) Object arg2 );
102+ String threeArgsMethod (Object arg0 , @ SortDefault Pageable arg1 , @ SortDefault @ Param ("foo" ) Object arg2 );
97103 }
98104}
0 commit comments