@@ -192,7 +192,7 @@ void doesNotValidateCountQueryIfNotPagingMethod() throws Exception {
192192 createJpaQuery (method );
193193 }
194194
195- @ Test // DATAJPA-352
195+ @ Test // DATAJPA-352, GH-2736
196196 void validatesAndRejectsCountQueryIfPagingMethod () throws Exception {
197197
198198 Method method = SampleRepository .class .getMethod ("pageByAnnotatedQuery" , Pageable .class );
@@ -201,7 +201,7 @@ void validatesAndRejectsCountQueryIfPagingMethod() throws Exception {
201201
202202 assertThatIllegalArgumentException () //
203203 .isThrownBy (() -> createJpaQuery (method )) //
204- .withMessageContaining ("Count " ) //
204+ .withMessageContaining ("User u " ) //
205205 .withMessageContaining (method .getName ());
206206 }
207207
@@ -293,19 +293,19 @@ void resolvesExpressionInCountQuery() throws Exception {
293293 }
294294
295295 private AbstractJpaQuery createJpaQuery (Method method ) {
296- return createJpaQuery (method , null );
296+ return createJpaQuery (method , Optional . empty () );
297297 }
298298
299- private AbstractJpaQuery createJpaQuery (JpaQueryMethod queryMethod , @ Nullable String queryString , @ Nullable String countQueryString ) {
299+ private AbstractJpaQuery createJpaQuery (JpaQueryMethod queryMethod , String queryString , @ Nullable String countQueryString ) {
300300
301301 return JpaQueryFactory .INSTANCE .fromMethodWithQueryString (queryMethod , em , queryString , countQueryString ,
302302 QueryRewriter .IdentityQueryRewriter .INSTANCE , ValueExpressionDelegate .create ());
303303 }
304304
305- private AbstractJpaQuery createJpaQuery (Method method , @ Nullable Optional <String > countQueryString ) {
305+ private AbstractJpaQuery createJpaQuery (Method method , Optional <String > countQueryString ) {
306306
307307 JpaQueryMethod queryMethod = new JpaQueryMethod (method , metadata , factory , extractor );
308- return createJpaQuery (queryMethod , queryMethod .getAnnotatedQuery (), countQueryString == null ? null : countQueryString .orElse (queryMethod .getCountQuery ()));
308+ return createJpaQuery (queryMethod , queryMethod .getAnnotatedQuery (), countQueryString .orElse (queryMethod .getCountQuery ()));
309309 }
310310
311311 interface SampleRepository {
0 commit comments