DATAREST-1008 - Adapt to API changes in Spring Data Commons, Java 8 upgrades and Mockito 2.7.
This commit is contained in:
7
spring-data-rest-hal-browser/src/test/java/org/springframework/data/rest/webmvc/halbrowser/HalBrowserIntegrationTests.java
Normal file → Executable file
7
spring-data-rest-hal-browser/src/test/java/org/springframework/data/rest/webmvc/halbrowser/HalBrowserIntegrationTests.java
Normal file → Executable 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() {
|
||||
|
||||
|
||||
9
spring-data-rest-hal-browser/src/test/java/org/springframework/data/rest/webmvc/halbrowser/HalBrowserUnitTests.java
Normal file → Executable file
9
spring-data-rest-hal-browser/src/test/java/org/springframework/data/rest/webmvc/halbrowser/HalBrowserUnitTests.java
Normal file → Executable 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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user