Search in sources :

Example 1 with LinkDiscoverer

use of org.springframework.hateoas.LinkDiscoverer in project spring-boot by spring-projects.

the class HypermediaAutoConfigurationTests method linkDiscoverersCreated.

@Test
public void linkDiscoverersCreated() throws Exception {
    this.context = new AnnotationConfigWebApplicationContext();
    this.context.setServletContext(new MockServletContext());
    this.context.register(BaseConfig.class);
    this.context.refresh();
    LinkDiscoverers discoverers = this.context.getBean(LinkDiscoverers.class);
    assertThat(discoverers).isNotNull();
    LinkDiscoverer discoverer = discoverers.getLinkDiscovererFor(MediaTypes.HAL_JSON);
    assertThat(HalLinkDiscoverer.class.isInstance(discoverer)).isTrue();
}
Also used : AnnotationConfigWebApplicationContext(org.springframework.web.context.support.AnnotationConfigWebApplicationContext) LinkDiscoverer(org.springframework.hateoas.LinkDiscoverer) HalLinkDiscoverer(org.springframework.hateoas.hal.HalLinkDiscoverer) MockServletContext(org.springframework.mock.web.MockServletContext) LinkDiscoverers(org.springframework.hateoas.LinkDiscoverers) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 LinkDiscoverer (org.springframework.hateoas.LinkDiscoverer)1 LinkDiscoverers (org.springframework.hateoas.LinkDiscoverers)1 HalLinkDiscoverer (org.springframework.hateoas.hal.HalLinkDiscoverer)1 MockServletContext (org.springframework.mock.web.MockServletContext)1 AnnotationConfigWebApplicationContext (org.springframework.web.context.support.AnnotationConfigWebApplicationContext)1