DATACMNS-61 - Fixed Parameters lookup in QueryMethod.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2010 the original author or authors.
|
||||
* Copyright 2008-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -73,15 +73,17 @@ public class QueryMethod {
|
||||
}
|
||||
|
||||
this.method = method;
|
||||
this.parameters = getParameters();
|
||||
this.parameters = createParameters(method);
|
||||
this.metadata = metadata;
|
||||
|
||||
Assert.notNull(this.parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link Parameters} instance.
|
||||
*
|
||||
* @param method
|
||||
* @return
|
||||
* @return must not return {@literal null}.
|
||||
*/
|
||||
protected Parameters createParameters(Method method) {
|
||||
return new Parameters(method);
|
||||
|
||||
@@ -41,8 +41,16 @@ public class QueryMethodUnitTest {
|
||||
Method method = SampleRepository.class.getMethod("pagingMethodWithInvalidReturnType", Pageable.class);
|
||||
new QueryMethod(method, metadata);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setsUpSimpleQueryMethodCorrectly() throws NoSuchMethodException, SecurityException {
|
||||
Method method = SampleRepository.class.getMethod("findByUsername", String.class);
|
||||
new QueryMethod(method, metadata);
|
||||
}
|
||||
|
||||
interface SampleRepository {
|
||||
String pagingMethodWithInvalidReturnType(Pageable pageable);
|
||||
|
||||
String findByUsername(String username);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user