DATACMNS-61 - Fixed Parameters lookup in QueryMethod.

This commit is contained in:
Oliver Gierke
2011-08-21 14:46:44 +02:00
parent 2b167566e1
commit 5cfd8bc3df
2 changed files with 13 additions and 3 deletions

View File

@@ -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);

View File

@@ -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);
}
}