DATAREST-1545 - Polishing.

This commit is contained in:
Oliver Drotbohm
2020-09-15 17:09:59 +02:00
parent 9737366174
commit 0392103371
3 changed files with 15 additions and 104 deletions

View File

@@ -19,25 +19,16 @@ import static org.hamcrest.CoreMatchers.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.ConversionService;
import org.springframework.data.geo.GeoModule;
import org.springframework.context.annotation.Import;
import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurer;
import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration;
import org.springframework.hateoas.MediaTypes;
import org.springframework.hateoas.mediatype.MessageResolver;
import org.springframework.hateoas.server.mvc.RepresentationModelProcessorInvoker;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.test.context.ContextConfiguration;
@@ -48,8 +39,6 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* Integration tests for {@link HalExplorer}.
*
@@ -67,14 +56,8 @@ public class HalExplorerIntegrationTests {
@Configuration
@EnableWebMvc
static class TestConfiguration extends RepositoryRestMvcConfiguration {
public TestConfiguration(ApplicationContext context, ObjectFactory<ConversionService> conversionService) {
super(context, conversionService, Optional.empty(), Optional.empty(), Optional.empty(),
new ObjectMapperProvider(), new RepresentationModelProcessorInvokerProvider(), MessageResolver.DEFAULTS_ONLY,
new GeoModule());
}
@Import(RepositoryRestMvcConfiguration.class)
static class TestConfiguration {
@Bean
RepositoryRestConfigurer configExtension() {
@@ -131,51 +114,4 @@ public class HalExplorerIntegrationTests {
andExpect(status().isOk()).//
andExpect(header().string(HttpHeaders.CONTENT_TYPE, startsWith(MediaType.APPLICATION_JSON_VALUE)));
}
private static class ObjectMapperProvider implements ObjectProvider<ObjectMapper> {
@Override
public ObjectMapper getObject(Object... args) throws BeansException {
return null;
}
@Override
public ObjectMapper getIfAvailable() throws BeansException {
return null;
}
@Override
public ObjectMapper getIfUnique() throws BeansException {
return null;
}
@Override
public ObjectMapper getObject() throws BeansException {
return null;
}
}
private static class RepresentationModelProcessorInvokerProvider
implements ObjectProvider<RepresentationModelProcessorInvoker> {
@Override
public RepresentationModelProcessorInvoker getObject(Object... args) throws BeansException {
return null;
}
@Override
public RepresentationModelProcessorInvoker getIfAvailable() throws BeansException {
return null;
}
@Override
public RepresentationModelProcessorInvoker getIfUnique() throws BeansException {
return null;
}
@Override
public RepresentationModelProcessorInvoker getObject() throws BeansException {
return null;
}
}
}