DATACMNS-937 - Polishing.

Removed Spring 4.2 guard from QueryExecutionConverter and its unit tests.
This commit is contained in:
Oliver Gierke
2016-11-19 12:46:49 +01:00
parent 71fc87ad42
commit e009471aaa
2 changed files with 3 additions and 21 deletions

View File

@@ -61,13 +61,6 @@ import com.google.common.base.Optional;
*/
public abstract class QueryExecutionConverters {
private static final boolean SPRING_4_2_PRESENT = ClassUtils.isPresent(
"org.springframework.core.annotation.AnnotationConfigurationException",
QueryExecutionConverters.class.getClassLoader());
private static final boolean ASYNC_RESULT_PRESENT = ClassUtils.isPresent(
"org.springframework.scheduling.annotation.AsyncResult", QueryExecutionConverters.class.getClassLoader());
private static final boolean GUAVA_PRESENT = ClassUtils.isPresent("com.google.common.base.Optional",
QueryExecutionConverters.class.getClassLoader());
private static final boolean JDK_8_PRESENT = ClassUtils.isPresent("java.util.Optional",
@@ -100,7 +93,7 @@ public abstract class QueryExecutionConverters {
UNWRAPPERS.add(Jdk8OptionalUnwrapper.INSTANCE);
}
if (JDK_8_PRESENT && SPRING_4_2_PRESENT) {
if (JDK_8_PRESENT) {
WRAPPER_TYPES.add(NullableWrapperToCompletableFutureConverter.getWrapperType());
UNWRAPPER_TYPES.add(NullableWrapperToCompletableFutureConverter.getWrapperType());
}
@@ -189,9 +182,7 @@ public abstract class QueryExecutionConverters {
conversionService.addConverter(new NullableWrapperToJavaSlangOptionConverter(conversionService));
}
if (ASYNC_RESULT_PRESENT) {
conversionService.addConverter(new NullableWrapperToFutureConverter(conversionService));
}
conversionService.addConverter(new NullableWrapperToFutureConverter(conversionService));
}
/**
@@ -519,7 +510,7 @@ public abstract class QueryExecutionConverters {
*
* @author Oliver Gierke
* @author Mark Paluch
* @author 1.13
* @since 1.12
*/
private static enum ScalOptionUnwrapper implements Converter<Object, Object> {

View File

@@ -17,7 +17,6 @@ package org.springframework.data.repository.util;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.junit.Assume.*;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -33,9 +32,7 @@ import java.util.concurrent.Future;
import org.junit.Before;
import org.junit.Test;
import org.reactivestreams.Publisher;
import org.springframework.core.SpringVersion;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.data.util.Version;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.concurrent.ListenableFuture;
@@ -49,9 +46,6 @@ import com.google.common.base.Optional;
*/
public class QueryExecutionConvertersUnitTests {
private static final Version SPRING_VERSION = Version.parse(SpringVersion.getVersion());
private static final Version FOUR_DOT_TWO = new Version(4, 2);
DefaultConversionService conversionService;
@Before
@@ -131,9 +125,6 @@ public class QueryExecutionConvertersUnitTests {
*/
@Test
public void registersCompletableFutureAsWrapperTypeOnSpring42OrBetter() {
assumeThat(SPRING_VERSION.isGreaterThanOrEqualTo(FOUR_DOT_TWO), is(true));
assertThat(QueryExecutionConverters.supports(CompletableFuture.class), is(true));
}