DATAREST-1509 - Polishing.
Simplify assertion style. Convert space indents to tabs. Original pull request: #374.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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<String> 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<String> suffix(String suffix) {
|
||||
return s -> s.endsWith(suffix);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user