2525import org .springframework .data .domain .ScrollPosition ;
2626import org .springframework .data .domain .Sort ;
2727import org .springframework .data .domain .Sort .Order ;
28+ import org .springframework .data .repository .core .RepositoryMetadata ;
2829
2930/**
3031 * Unit tests for {@link ParametersParameterAccessor}.
3637class ParametersParameterAccessorUnitTests {
3738
3839 Parameters <?, ?> parameters ;
40+ RepositoryMetadata metadata ;
3941
4042 @ BeforeEach
4143 void setUp () throws Exception {
42- parameters = new DefaultParameters (Sample .class .getMethod ("method" , String .class , int .class ));
44+ parameters = new DefaultParameters (ParametersSource . of ( Sample .class .getMethod ("method" , String .class , int .class ) ));
4345 }
4446
4547 @ Test
@@ -62,7 +64,7 @@ void detectsNullValue() throws Exception {
6264 assertThat (accessor .hasBindableNullValue ()).isTrue ();
6365
6466 var method = Sample .class .getMethod ("method" , Pageable .class , String .class );
65- var parameters = new DefaultParameters (method );
67+ var parameters = new DefaultParameters (ParametersSource . of ( method ) );
6668
6769 accessor = new ParametersParameterAccessor (parameters , new Object [] { null , "Foo" });
6870 assertThat (accessor .hasBindableNullValue ()).isFalse ();
@@ -72,7 +74,7 @@ void detectsNullValue() throws Exception {
7274 void iteratesonlyOverBindableValues () throws Exception {
7375
7476 var method = Sample .class .getMethod ("method" , Pageable .class , String .class );
75- var parameters = new DefaultParameters (method );
77+ var parameters = new DefaultParameters (ParametersSource . of ( method ) );
7678
7779 var accessor = new ParametersParameterAccessor (parameters , new Object [] { PageRequest .of (0 , 10 ), "Foo" });
7880
@@ -84,7 +86,7 @@ void iteratesonlyOverBindableValues() throws Exception {
8486 void handlesScrollPositionAsAParameterType () throws NoSuchMethodException {
8587
8688 var method = Sample .class .getMethod ("method" , ScrollPosition .class , String .class );
87- var parameters = new DefaultParameters (method );
89+ var parameters = new DefaultParameters (ParametersSource . of ( method ) );
8890
8991 var accessor = new ParametersParameterAccessor (parameters , new Object [] { ScrollPosition .offset (1 ), "Foo" });
9092
@@ -96,7 +98,7 @@ void handlesScrollPositionAsAParameterType() throws NoSuchMethodException {
9698 void handlesPageRequestAsAParameterType () throws NoSuchMethodException {
9799
98100 var method = Sample .class .getMethod ("methodWithPageRequest" , PageRequest .class , String .class );
99- var parameters = new DefaultParameters (method );
101+ var parameters = new DefaultParameters (ParametersSource . of ( method ) );
100102
101103 var accessor = new ParametersParameterAccessor (parameters , new Object [] { PageRequest .of (0 , 10 ), "Foo" });
102104
@@ -108,7 +110,7 @@ void handlesPageRequestAsAParameterType() throws NoSuchMethodException {
108110 void handlesLimitAsAParameterType () throws NoSuchMethodException {
109111
110112 var method = Sample .class .getMethod ("method" , Limit .class , String .class );
111- var accessor = new ParametersParameterAccessor (new DefaultParameters (method ),
113+ var accessor = new ParametersParameterAccessor (new DefaultParameters (ParametersSource . of ( method ) ),
112114 new Object [] { Limit .of (100 ), "spring" });
113115
114116 assertThat (accessor ).hasSize (1 );
@@ -119,7 +121,7 @@ void handlesLimitAsAParameterType() throws NoSuchMethodException {
119121 void returnsLimitIfAvailable () throws NoSuchMethodException {
120122
121123 var method = Sample .class .getMethod ("method" , Limit .class , String .class );
122- var accessor = new ParametersParameterAccessor (new DefaultParameters (method ),
124+ var accessor = new ParametersParameterAccessor (new DefaultParameters (ParametersSource . of ( method ) ),
123125 new Object [] { Limit .of (100 ), "spring" });
124126
125127 assertThat (accessor .getLimit ()).extracting (Limit ::max ).isEqualTo (100 );
@@ -129,7 +131,7 @@ void returnsLimitIfAvailable() throws NoSuchMethodException {
129131 void readsLimitFromPageableIfAvailable () throws NoSuchMethodException {
130132
131133 var method = Sample .class .getMethod ("method" , Pageable .class , String .class );
132- var accessor = new ParametersParameterAccessor (new DefaultParameters (method ),
134+ var accessor = new ParametersParameterAccessor (new DefaultParameters (ParametersSource . of ( method ) ),
133135 new Object [] { Pageable .ofSize (100 ), "spring" });
134136
135137 assertThat (accessor .getLimit ()).extracting (Limit ::max ).isEqualTo (100 );
@@ -139,7 +141,7 @@ void readsLimitFromPageableIfAvailable() throws NoSuchMethodException {
139141 void returnsUnlimitedIfNoLimitingAvailable () throws NoSuchMethodException {
140142
141143 var method = Sample .class .getMethod ("method" , Sort .class , String .class );
142- var accessor = new ParametersParameterAccessor (new DefaultParameters (method ),
144+ var accessor = new ParametersParameterAccessor (new DefaultParameters (ParametersSource . of ( method ) ),
143145 new Object [] { Pageable .ofSize (100 ), "spring" });
144146
145147 assertThat (accessor .getLimit ().isUnlimited ()).isTrue ();
@@ -149,7 +151,7 @@ void returnsUnlimitedIfNoLimitingAvailable() throws NoSuchMethodException {
149151 void appliesLimitToPageableIfAvailable () throws NoSuchMethodException {
150152
151153 var method = Sample .class .getMethod ("method" , Limit .class , String .class );
152- var accessor = new ParametersParameterAccessor (new DefaultParameters (method ),
154+ var accessor = new ParametersParameterAccessor (new DefaultParameters (ParametersSource . of ( method ) ),
153155 new Object [] { Limit .of (100 ), "spring" });
154156
155157 Pageable pageable = accessor .getPageable ();
@@ -161,7 +163,7 @@ void appliesLimitToPageableIfAvailable() throws NoSuchMethodException {
161163 void appliesLimitToPageableIfRequested () throws NoSuchMethodException {
162164
163165 var method = Sample .class .getMethod ("method" , Limit .class , String .class );
164- var accessor = new ParametersParameterAccessor (new DefaultParameters (method ),
166+ var accessor = new ParametersParameterAccessor (new DefaultParameters (ParametersSource . of ( method ) ),
165167 new Object [] { Limit .of (100 ), "spring" });
166168
167169 assertThat (accessor ).hasSize (1 );
@@ -172,7 +174,7 @@ void appliesLimitToPageableIfRequested() throws NoSuchMethodException {
172174 void appliesSortToPageableIfAvailable () throws NoSuchMethodException {
173175
174176 var method = Sample .class .getMethod ("method" , Sort .class , String .class );
175- var accessor = new ParametersParameterAccessor (new DefaultParameters (method ),
177+ var accessor = new ParametersParameterAccessor (new DefaultParameters (ParametersSource . of ( method ) ),
176178 new Object [] { Sort .by ("one" , "two" ), "spring" });
177179
178180 Pageable pageable = accessor .getPageable ();
@@ -184,7 +186,7 @@ void appliesSortToPageableIfAvailable() throws NoSuchMethodException {
184186 void appliesSortAndLimitToPageableIfAvailable () throws NoSuchMethodException {
185187
186188 var method = Sample .class .getMethod ("method" , Sort .class , Limit .class , String .class );
187- var accessor = new ParametersParameterAccessor (new DefaultParameters (method ),
189+ var accessor = new ParametersParameterAccessor (new DefaultParameters (ParametersSource . of ( method ) ),
188190 new Object [] { Sort .by ("one" , "two" ), Limit .of (42 ), "spring" });
189191
190192 Pageable pageable = accessor .getPageable ();
0 commit comments