DATACMNS-864 - Tweaks in tests after activation for Spring 5 builds.

After the Spring 5 build profile has been activated properly in Spring Data build [0], the test cases for RepositoryPopulators failed as there was only an explicit detection of Spring 4 to point the test to the right resource file. Removed the guard now as all supported versions can now use the same file.

Adapt to the stricter contract in Spring 5's MethodParameter in unit test for QuerydsPredicateArgumentResolver.

[0] 31df5de907
This commit is contained in:
Oliver Gierke
2016-09-09 23:25:31 +02:00
parent e884a6678c
commit db62390de9
3 changed files with 3 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,6 @@ import org.junit.Test;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.core.SpringVersion;
import org.springframework.core.io.ClassPathResource;
import org.springframework.data.repository.init.Jackson2ResourceReader;
import org.springframework.data.repository.init.ResourceReaderRepositoryPopulator;
@@ -98,11 +97,7 @@ public class ResourceReaderRepositoryPopulatorBeanDefinitionParserIntegrationTes
}
private static ClassPathResource getPopulatorResource() {
String springVersion = SpringVersion.getVersion();
String populatorsResourceName = springVersion.startsWith("4") ? "populators-spring-4.0.xml" : "populators.xml";
return new ClassPathResource(populatorsResourceName,
return new ClassPathResource("populators.xml",
ResourceReaderRepositoryPopulatorBeanDefinitionParserIntegrationTests.class);
}
}

View File

@@ -254,7 +254,7 @@ public class QuerydslPredicateArgumentResolverUnitTests {
private static MethodParameter getMethodParameterFor(String methodName, Class<?>... args) throws RuntimeException {
try {
return new MethodParameter(Sample.class.getMethod(methodName, args), 0);
return new MethodParameter(Sample.class.getMethod(methodName, args), args.length == 0 ? -1 : 0);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}