Example usage for org.springframework.data.web WebTestUtils createApplicationContext

List of usage examples for org.springframework.data.web WebTestUtils createApplicationContext

Introduction

In this page you can find the example usage for org.springframework.data.web WebTestUtils createApplicationContext.

Prototype

public static WebApplicationContext createApplicationContext(ClassLoader classLoader,
        Class<?>... configClasses) 

Source Link

Document

Creates a WebApplicationContext from the given configuration classes.

Usage

From source file:org.springframework.data.web.config.EnableSpringDataWebSupportIntegrationTests.java

@Test // DATACMNS-330
public void doesNotRegisterHateoasSpecificComponentsIfHateoasNotPresent() throws Exception {

    HidingClassLoader classLoader = HidingClassLoader.hide(Link.class);

    ApplicationContext context = WebTestUtils.createApplicationContext(classLoader, SampleConfig.class);

    List<String> names = Arrays.asList(context.getBeanDefinitionNames());

    assertThat(names).contains("pageableResolver", "sortResolver");
    assertThat(names).doesNotContain("pagedResourcesAssembler", "pagedResourcesAssemblerArgumentResolver");
}

From source file:org.springframework.data.web.config.EnableSpringDataWebSupportIntegrationTests.java

@Test // DATACMNS-475
public void doesNotRegisterJacksonSpecificComponentsIfJacksonNotPresent() throws Exception {

    ApplicationContext context = WebTestUtils
            .createApplicationContext(HidingClassLoader.hide(ObjectMapper.class), SampleConfig.class);

    List<String> names = Arrays.asList(context.getBeanDefinitionNames());

    assertThat(names).doesNotContain("jacksonGeoModule");
}