diff --git a/Jenkinsfile b/Jenkinsfile index 08b6c4876..8ec90df36 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -104,25 +104,6 @@ pipeline { sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pjava11 clean dependency:list test -Dsort -U -B -Pit,spring52-next,jackson-next' } } - stage("test: spring52/jackson-next (jdk11)") { - agent { - docker { - image 'springci/spring-data-openjdk11-with-mongodb-4.2.0:latest' - label 'data' - args '-v $HOME:/tmp/jenkins-home' - } - } - options { timeout(time: 30, unit: 'MINUTES') } - steps { - sh 'rm -rf ?' - sh 'mkdir -p /tmp/mongodb/db /tmp/mongodb/log' - sh 'mongod --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log &' - sh 'sleep 10' - sh 'mongo --eval "rs.initiate({_id: \'rs0\', members:[{_id: 0, host: \'127.0.0.1:27017\'}]});"' - sh 'sleep 15' - sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pjava11 clean dependency:list test -Dsort -U -B -Pit,spring52-next,jackson-next' - } - } stage("test: spring52/jackson-next (jdk14)") { agent { docker { diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvConfigurationIntegrationTests.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvConfigurationIntegrationTests.java index de35655be..9a91f5bc9 100755 --- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvConfigurationIntegrationTests.java +++ b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvConfigurationIntegrationTests.java @@ -16,24 +16,19 @@ package org.springframework.data.rest.webmvc.config; import static org.assertj.core.api.Assertions.*; -import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.*; import static org.springframework.data.rest.webmvc.util.AssertionUtils.*; -import java.util.Arrays; import java.util.Collection; import java.util.Date; import java.util.List; -import java.util.Locale; -import java.util.TimeZone; -import java.util.function.Predicate; import javax.naming.Name; import javax.naming.ldap.LdapName; -import org.assertj.core.api.Condition; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; + import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -50,10 +45,8 @@ import org.springframework.data.rest.webmvc.RepositoryLinksResource; import org.springframework.data.rest.webmvc.RestMediaTypes; import org.springframework.data.rest.webmvc.alps.AlpsJsonHttpMessageConverter; import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module; -import org.springframework.data.rest.webmvc.util.AssertionUtils; import org.springframework.data.web.HateoasPageableHandlerMethodArgumentResolver; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; -import org.springframework.format.datetime.DateFormatter; import org.springframework.hateoas.MediaTypes; import org.springframework.hateoas.client.LinkDiscoverers; import org.springframework.hateoas.server.core.DefaultLinkRelationProvider; @@ -134,10 +127,9 @@ public class RepositoryRestMvConfigurationIntegrationTests { String result = JsonPath.read(mapper.writeValueAsString(sample), "$.date"); - assertThat(result).is(anyOf( // - new Condition<>(endsWith("+00"), "ISO-8601-TZ1"), // - new Condition<>(endsWith("+0000"), "ISO-8601-TZ2"), // - new Condition<>(endsWith("+00:00"), "ISO-8601-TZ3"))); + assertThat(result).matches(suffix("+00") // + .or(suffix("+0000")) // + .or(suffix("+00:00")), "ISO-8601-TZ1, ISO-8601-TZ2, or ISO-8601-TZ3"); } @Test(expected = NoSuchBeanDefinitionException.class) // DATAREST-362 diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/util/AssertionUtils.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/util/AssertionUtils.java index 470978f07..264445beb 100644 --- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/util/AssertionUtils.java +++ b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/util/AssertionUtils.java @@ -9,14 +9,13 @@ import java.util.function.Predicate; */ public final class AssertionUtils { - - /** - * {@link Predicate} to verify a given string ends in a certain pattern. - * - * @param pattern - * @return - */ - public static Predicate endsWith(String pattern) { - return s -> s.endsWith(pattern); - } + /** + * {@link Predicate} to verify a given string ends in a certain suffix. + * + * @param suffix + * @return + */ + public static Predicate suffix(String suffix) { + return s -> s.endsWith(suffix); + } }