DATAREST-1008 - Adapt to API changes in Spring Data Commons, Java 8 upgrades and Mockito 2.7.

This commit is contained in:
Oliver Gierke
2017-03-01 12:30:47 +01:00
parent 272dc179ad
commit b9957d1a6c
159 changed files with 2230 additions and 2220 deletions

View File

@@ -22,9 +22,12 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.ObjectFactory;
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.rest.core.config.RepositoryRestConfiguration;
import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurerAdapter;
import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration;
@@ -58,6 +61,10 @@ public class HalBrowserIntegrationTests {
@EnableWebMvc
static class TestConfiguration extends RepositoryRestMvcConfiguration {
public TestConfiguration(ApplicationContext context, ObjectFactory<ConversionService> conversionService) {
super(context, conversionService);
}
@Bean
RepositoryRestConfigurerAdapter configExtension() {

View File

@@ -15,8 +15,9 @@
*/
package org.springframework.data.rest.webmvc.halbrowser;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.junit.Assert.assertThat;
import java.util.Collections;
@@ -48,14 +49,14 @@ public class HalBrowserUnitTests {
View view = new HalBrowser().browser(request);
assertThat(view, is(instanceOf(RedirectView.class)));
assertThat(view).isInstanceOf(RedirectView.class);
((AbstractView) view).render(Collections.<String, Object> emptyMap(), request, response);
UriComponents components = UriComponentsBuilder.fromUriString(response.getHeader(HttpHeaders.LOCATION)).build();
assertThat(components.getPath(), startsWith("/context"));
assertThat(components.getFragment(), is("/context"));
assertThat(components.getFragment()).isEqualTo("/context");
}
@Test
@@ -69,7 +70,7 @@ public class HalBrowserUnitTests {
View view = new HalBrowser().browser(request);
assertThat(view, is(instanceOf(RedirectView.class)));
assertThat(view).isInstanceOf(RedirectView.class);
String url = ((RedirectView) view).getUrl();