Search in sources :

Example 1 with MappingJackson2JsonView

use of cn.taketoday.web.view.json.MappingJackson2JsonView in project today-infrastructure by TAKETODAY.

the class ViewResolverRegistryTests method contentNegotiation.

@Test
public void contentNegotiation() {
    MappingJackson2JsonView view = new MappingJackson2JsonView();
    this.registry.enableContentNegotiation(view);
    ContentNegotiatingViewResolver resolver = checkAndGetResolver(ContentNegotiatingViewResolver.class);
    assertThat(resolver.getDefaultViews()).isEqualTo(Arrays.asList(view));
    assertThat(this.registry.getOrder()).isEqualTo(Ordered.HIGHEST_PRECEDENCE);
}
Also used : ContentNegotiatingViewResolver(cn.taketoday.web.view.ContentNegotiatingViewResolver) MappingJackson2JsonView(cn.taketoday.web.view.json.MappingJackson2JsonView) Test(org.junit.jupiter.api.Test)

Example 2 with MappingJackson2JsonView

use of cn.taketoday.web.view.json.MappingJackson2JsonView in project today-framework by TAKETODAY.

the class ViewResolverRegistryTests method contentNegotiation.

@Test
public void contentNegotiation() {
    MappingJackson2JsonView view = new MappingJackson2JsonView();
    this.registry.enableContentNegotiation(view);
    ContentNegotiatingViewResolver resolver = checkAndGetResolver(ContentNegotiatingViewResolver.class);
    assertThat(resolver.getDefaultViews()).isEqualTo(Arrays.asList(view));
    assertThat(this.registry.getOrder()).isEqualTo(Ordered.HIGHEST_PRECEDENCE);
}
Also used : ContentNegotiatingViewResolver(cn.taketoday.web.view.ContentNegotiatingViewResolver) MappingJackson2JsonView(cn.taketoday.web.view.json.MappingJackson2JsonView) Test(org.junit.jupiter.api.Test)

Aggregations

ContentNegotiatingViewResolver (cn.taketoday.web.view.ContentNegotiatingViewResolver)2 MappingJackson2JsonView (cn.taketoday.web.view.json.MappingJackson2JsonView)2 Test (org.junit.jupiter.api.Test)2