Search in sources :

Example 1 with BaseUri

use of org.springframework.data.rest.webmvc.BaseUri in project spring-boot by spring-projects.

the class RepositoryRestMvcAutoConfigurationTests method testWithCustomBasePath.

@Test
public void testWithCustomBasePath() throws Exception {
    load(TestConfiguration.class, "spring.data.rest.base-path:foo");
    assertThat(this.context.getBean(RepositoryRestMvcConfiguration.class)).isNotNull();
    RepositoryRestConfiguration bean = this.context.getBean(RepositoryRestConfiguration.class);
    URI expectedUri = URI.create("/foo");
    assertThat(bean.getBaseUri()).as("Custom basePath not set").isEqualTo(expectedUri);
    BaseUri baseUri = this.context.getBean(BaseUri.class);
    assertThat(expectedUri).as("Custom basePath has not been applied to BaseUri bean").isEqualTo(baseUri.getUri());
}
Also used : RepositoryRestConfiguration(org.springframework.data.rest.core.config.RepositoryRestConfiguration) URI(java.net.URI) BaseUri(org.springframework.data.rest.webmvc.BaseUri) Test(org.junit.Test)

Aggregations

URI (java.net.URI)1 Test (org.junit.Test)1 RepositoryRestConfiguration (org.springframework.data.rest.core.config.RepositoryRestConfiguration)1 BaseUri (org.springframework.data.rest.webmvc.BaseUri)1