|
1 | 1 | /*
|
2 |
| - * Copyright 2013-2014 the original author or authors. |
| 2 | + * Copyright 2013-2016 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -94,22 +94,6 @@ public void discoversCustomlyImplementedCrudMethod() throws SecurityException, N
|
94 | 94 | assertThat(information.getTargetClassMethod(source), is(expected));
|
95 | 95 | }
|
96 | 96 |
|
97 |
| - /** |
98 |
| - * @see DATACMNS-854 |
99 |
| - */ |
100 |
| - @Test |
101 |
| - public void discoversCustomlyImplementedCrudMethodWithGenerics() throws SecurityException, NoSuchMethodException { |
102 |
| - |
103 |
| - RepositoryMetadata metadata = new DefaultRepositoryMetadata(FooRepository.class); |
104 |
| - RepositoryInformation information = new DefaultRepositoryInformation(metadata, CrudRepository.class, |
105 |
| - customImplementation.getClass()); |
106 |
| - |
107 |
| - Method source = FooRepositoryCustom.class.getMethod("exists", Object.class); |
108 |
| - Method expected = customImplementation.getClass().getMethod("exists", Object.class); |
109 |
| - |
110 |
| - assertThat(information.getTargetClassMethod(source), is(expected)); |
111 |
| - } |
112 |
| - |
113 | 97 | @Test
|
114 | 98 | public void considersIntermediateMethodsAsFinderMethods() {
|
115 | 99 |
|
@@ -239,20 +223,37 @@ public void getQueryShouldNotReturnAnyBridgeMethods() {
|
239 | 223 | }
|
240 | 224 | }
|
241 | 225 |
|
242 |
| - private Method getMethodFrom(Class<?> type, String name) { |
| 226 | + /** |
| 227 | + * @see DATACMNS-854 |
| 228 | + */ |
| 229 | + @Test |
| 230 | + public void discoversCustomlyImplementedCrudMethodWithGenerics() throws SecurityException, NoSuchMethodException { |
| 231 | + |
| 232 | + RepositoryMetadata metadata = new DefaultRepositoryMetadata(FooRepository.class); |
| 233 | + RepositoryInformation information = new DefaultRepositoryInformation(metadata, CrudRepository.class, |
| 234 | + customImplementation.getClass()); |
| 235 | + |
| 236 | + Method source = FooRepositoryCustom.class.getMethod("exists", Object.class); |
| 237 | + Method expected = customImplementation.getClass().getMethod("exists", Object.class); |
| 238 | + |
| 239 | + assertThat(information.getTargetClassMethod(source), is(expected)); |
| 240 | + } |
| 241 | + |
| 242 | + private static Method getMethodFrom(Class<?> type, String name) { |
| 243 | + |
243 | 244 | for (Method method : type.getMethods()) {
|
244 | 245 | if (method.getName().equals(name)) {
|
245 | 246 | return method;
|
246 | 247 | }
|
247 | 248 | }
|
| 249 | + |
248 | 250 | return null;
|
249 | 251 | }
|
250 | 252 |
|
251 | 253 | @Target(ElementType.METHOD)
|
252 | 254 | @Retention(RetentionPolicy.RUNTIME)
|
253 | 255 | @QueryAnnotation
|
254 | 256 | @interface MyQuery {
|
255 |
| - |
256 | 257 | }
|
257 | 258 |
|
258 | 259 | interface FooRepository extends CrudRepository<User, Integer>, FooRepositoryCustom {
|
|
0 commit comments