DATACMNS-1005 - Polishing.

Simplified type check by using Set as method signature to avoid unnecessary manual array wrapping. Simplification in the test assertions. A bit of Javadoc, corrected imports and author tags.

Original pull request: #200.
This commit is contained in:
Oliver Gierke
2017-03-09 10:58:19 +01:00
parent b194f7794d
commit be4498659d
4 changed files with 30 additions and 18 deletions

View File

@@ -46,6 +46,7 @@ import org.springframework.data.util.Version;
*
* @author Oliver Gierke
* @author Thomas Darimont
* @author Maciek Opała
*/
public class QueryMethodUnitTests {

View File

@@ -15,7 +15,7 @@
*/
package org.springframework.data.repository.util;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.springframework.data.repository.util.QueryExecutionConverters.*;
@@ -41,10 +41,13 @@ import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
import org.reactivestreams.Publisher;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Slice;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.concurrent.ListenableFuture;
@@ -55,6 +58,7 @@ import com.google.common.base.Optional;
*
* @author Oliver Gierke
* @author Mark Paluch
* @author Maciek Opała
*/
public class QueryExecutionConvertersUnitTests {
@@ -273,11 +277,8 @@ public class QueryExecutionConvertersUnitTests {
@Test // DATACMNS-1005
public void registersAllowedPageabletypes() {
final Set<Class<?>> allowedPageableTypes = QueryExecutionConverters.getAllowedPageableTypes();
assertThat(allowedPageableTypes, hasItem(Page.class));
assertThat(allowedPageableTypes, hasItem(Slice.class));
assertThat(allowedPageableTypes, hasItem(List.class));
assertThat(allowedPageableTypes, hasItem(Seq.class));
Set<Class<?>> allowedPageableTypes = QueryExecutionConverters.getAllowedPageableTypes();
assertThat(allowedPageableTypes, Matchers.<Class<?>> hasItems(Page.class, Slice.class, List.class, Seq.class));
}
@SuppressWarnings("unchecked")