Commit 43e2df10 authored by Andy Wilkinson's avatar Andy Wilkinson

Align with latest changes in Spring Data REST

parent cf3b1f66
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.data.rest; ...@@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.data.rest;
import java.net.URI; import java.net.URI;
import java.util.Date; import java.util.Date;
import java.util.Map;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
...@@ -40,7 +39,7 @@ import org.springframework.context.annotation.Import; ...@@ -40,7 +39,7 @@ import org.springframework.context.annotation.Import;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration; import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
import org.springframework.data.rest.core.mapping.RepositoryDetectionStrategy.RepositoryDetectionStrategies; import org.springframework.data.rest.core.mapping.RepositoryDetectionStrategy.RepositoryDetectionStrategies;
import org.springframework.data.rest.webmvc.BaseUri; import org.springframework.data.rest.webmvc.BaseUri;
import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurerAdapter; import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurer;
import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration; import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
...@@ -146,24 +145,6 @@ public class RepositoryRestMvcAutoConfigurationTests { ...@@ -146,24 +145,6 @@ public class RepositoryRestMvcAutoConfigurationTests {
assertThat(bean.getBaseUri()).isEqualTo(URI.create("")); assertThat(bean.getBaseUri()).isEqualTo(URI.create(""));
} }
@Test
public void objectMappersAreConfiguredUsingObjectMapperBuilder()
throws JsonProcessingException {
load(TestConfigurationWithObjectMapperBuilder.class);
assertThatDateIsFormattedCorrectly("halObjectMapper");
assertThatDateIsFormattedCorrectly("objectMapper");
}
@Test
public void primaryObjectMapperIsAvailable() {
load(TestConfiguration.class);
Map<String, ObjectMapper> objectMappers = this.context
.getBeansOfType(ObjectMapper.class);
assertThat(objectMappers.size()).isGreaterThan(1);
this.context.getBean(ObjectMapper.class);
}
public void assertThatDateIsFormattedCorrectly(String beanName) public void assertThatDateIsFormattedCorrectly(String beanName)
throws JsonProcessingException { throws JsonProcessingException {
ObjectMapper objectMapper = this.context.getBean(beanName, ObjectMapper.class); ObjectMapper objectMapper = this.context.getBean(beanName, ObjectMapper.class);
...@@ -221,7 +202,7 @@ public class RepositoryRestMvcAutoConfigurationTests { ...@@ -221,7 +202,7 @@ public class RepositoryRestMvcAutoConfigurationTests {
} }
static class TestRepositoryRestConfigurer extends RepositoryRestConfigurerAdapter { static class TestRepositoryRestConfigurer implements RepositoryRestConfigurer {
@Override @Override
public void configureRepositoryRestConfiguration( public void configureRepositoryRestConfiguration(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment