DATACMNS-1383 - Parameters now properly detects Pageable and Sort extensions.
One of the constructors of Pageable wasn't properly checking for assignability of Pageable parameters to detect them but was expecting Pageable itself being used under all circumstances. This has now been opened up by an assignability check.
This commit is contained in:
@@ -18,13 +18,14 @@ package org.springframework.data.repository.query;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import rx.Single;
|
||||
import scala.collection.mutable.Publisher;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.reactivestreams.Publisher;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
@@ -180,6 +181,14 @@ public class ParametersUnitTests {
|
||||
assertThat(parameters.getParameter(0).getType()).isAssignableFrom(Single.class);
|
||||
}
|
||||
|
||||
@Test // DATACMNS-1383
|
||||
public void acceptsCustomPageableParameter() throws Exception {
|
||||
|
||||
Parameters<?, Parameter> parameters = getParametersFor("customPageable", SomePageable.class);
|
||||
|
||||
assertThat(parameters.hasPageableParameter()).isTrue();
|
||||
}
|
||||
|
||||
private Parameters<?, Parameter> getParametersFor(String methodName, Class<?>... parameterTypes)
|
||||
throws SecurityException, NoSuchMethodException {
|
||||
|
||||
@@ -217,5 +226,9 @@ public class ParametersUnitTests {
|
||||
void methodWithPublisher(Publisher<String> publisher);
|
||||
|
||||
void methodWithSingle(Single<String> single);
|
||||
|
||||
Page<Object> customPageable(SomePageable pageable);
|
||||
}
|
||||
|
||||
interface SomePageable extends Pageable {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user