diff --git a/pom.xml b/pom.xml index 4adeda446..64f7fc515 100644 --- a/pom.xml +++ b/pom.xml @@ -23,6 +23,20 @@ DATACMNS + + + spring4 + + + javax.servlet + javax.servlet-api + 3.0.1 + test + + + + + org.springframework @@ -132,13 +146,6 @@ 3.0 true - - - javax.servlet - javax.servlet-api - 3.0.1 - test - diff --git a/src/test/java/org/springframework/data/repository/config/ResourceReaderRepositoryPopulatorBeanDefinitionParserIntegrationTests.java b/src/test/java/org/springframework/data/repository/config/ResourceReaderRepositoryPopulatorBeanDefinitionParserIntegrationTests.java index 971e7870c..43271dc31 100644 --- a/src/test/java/org/springframework/data/repository/config/ResourceReaderRepositoryPopulatorBeanDefinitionParserIntegrationTests.java +++ b/src/test/java/org/springframework/data/repository/config/ResourceReaderRepositoryPopulatorBeanDefinitionParserIntegrationTests.java @@ -41,14 +41,6 @@ import org.springframework.test.util.ReflectionTestUtils; */ public class ResourceReaderRepositoryPopulatorBeanDefinitionParserIntegrationTests { - private ClassPathResource getPopulatorResource() { - String populatorsResourceName = "populators.xml"; - if (SpringVersion.getVersion().startsWith("4.0")) { - populatorsResourceName = "populators-spring-4.0.xml"; - } - return new ClassPathResource(populatorsResourceName, getClass()); - } - /** * @see DATACMNS-58 */ @@ -117,7 +109,7 @@ public class ResourceReaderRepositoryPopulatorBeanDefinitionParserIntegrationTes assertIsListOfClasspathResourcesWithPath(resources, "org/springframework/data/repository/init/data.xml"); } - private void assertIsListOfClasspathResourcesWithPath(Object source, String path) { + private static void assertIsListOfClasspathResourcesWithPath(Object source, String path) { assertThat(source, is(instanceOf(List.class))); List list = (List) source; @@ -127,4 +119,13 @@ public class ResourceReaderRepositoryPopulatorBeanDefinitionParserIntegrationTes ClassPathResource resource = (ClassPathResource) element; assertThat(resource.getPath(), is(path)); } + + private static ClassPathResource getPopulatorResource() { + + String springVersion = SpringVersion.getVersion(); + String populatorsResourceName = springVersion.startsWith("4") ? "populators-spring-4.0.xml" : "populators.xml"; + + return new ClassPathResource(populatorsResourceName, + ResourceReaderRepositoryPopulatorBeanDefinitionParserIntegrationTests.class); + } } diff --git a/src/test/java/org/springframework/data/util/ClassTypeInformationUnitTests.java b/src/test/java/org/springframework/data/util/ClassTypeInformationUnitTests.java index cb57bbcf9..f8ebca1de 100644 --- a/src/test/java/org/springframework/data/util/ClassTypeInformationUnitTests.java +++ b/src/test/java/org/springframework/data/util/ClassTypeInformationUnitTests.java @@ -26,7 +26,9 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.hamcrest.Matchers; import org.junit.Test; +import org.springframework.core.SpringVersion; import org.springframework.data.mapping.Person; /** @@ -104,7 +106,14 @@ public class ClassTypeInformationUnitTests { property = information.getProperty("rawSet"); assertEquals(Set.class, property.getType()); - assertEquals(Object.class, property.getComponentType().getType()); + + // Spring 4 returns null for component types of raw types + if (SpringVersion.getVersion().startsWith("4")) { + assertThat(property.getComponentType(), nullValue()); + } else { + assertThat(property.getComponentType().getType(), is(Matchers.> equalTo(Object.class))); + } + assertNull(property.getMapValueType()); }