Java 类org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HttpMessageConvertersAutoConfigurationTests.java   
@Test
public void defaultGsonConverter() throws Exception {
    this.context.register(GsonAutoConfiguration.class,
            HttpMessageConvertersAutoConfiguration.class);
    this.context.refresh();
    assertConverterBeanExists(GsonHttpMessageConverter.class,
            "gsonHttpMessageConverter");

    assertConverterBeanRegisteredWithHttpMessageConverters(
            GsonHttpMessageConverter.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HttpMessageConvertersAutoConfigurationTests.java   
@Test
public void jacksonIsPreferredByDefaultWhenBothGsonAndJacksonAreAvailable() {
    this.context.register(GsonAutoConfiguration.class, JacksonAutoConfiguration.class,
            HttpMessageConvertersAutoConfiguration.class);
    this.context.refresh();
    assertConverterBeanExists(MappingJackson2HttpMessageConverter.class,
            "mappingJackson2HttpMessageConverter");
    assertConverterBeanRegisteredWithHttpMessageConverters(
            MappingJackson2HttpMessageConverter.class);
    assertThat(this.context.getBeansOfType(GsonHttpMessageConverter.class)).isEmpty();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HttpMessageConvertersAutoConfigurationTests.java   
@Test
public void gsonCanBePreferredWhenBothGsonAndJacksonAreAvailable() {
    this.context.register(GsonAutoConfiguration.class, JacksonAutoConfiguration.class,
            HttpMessageConvertersAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.http.converters.preferred-json-mapper:gson");
    this.context.refresh();
    assertConverterBeanExists(GsonHttpMessageConverter.class,
            "gsonHttpMessageConverter");
    assertConverterBeanRegisteredWithHttpMessageConverters(
            GsonHttpMessageConverter.class);
    assertThat(this.context.getBeansOfType(MappingJackson2HttpMessageConverter.class))
            .isEmpty();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HttpMessageConvertersAutoConfigurationTests.java   
@Test
public void customGsonConverter() throws Exception {
    this.context.register(GsonAutoConfiguration.class, GsonConverterConfig.class,
            HttpMessageConvertersAutoConfiguration.class);
    this.context.refresh();
    assertConverterBeanExists(GsonHttpMessageConverter.class,
            "customGsonMessageConverter");

    assertConverterBeanRegisteredWithHttpMessageConverters(
            GsonHttpMessageConverter.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JestAutoConfigurationTests.java   
private void load(Class<?> config, String... environment) {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils.addEnvironment(context, environment);
    if (config != null) {
        context.register(config);
    }
    context.register(GsonAutoConfiguration.class, JestAutoConfiguration.class);
    context.refresh();
    this.context = context;
}
项目:spring-boot-concourse    文件:HttpMessageConvertersAutoConfigurationTests.java   
@Test
public void defaultGsonConverter() throws Exception {
    this.context.register(GsonAutoConfiguration.class,
            HttpMessageConvertersAutoConfiguration.class);
    this.context.refresh();
    assertConverterBeanExists(GsonHttpMessageConverter.class,
            "gsonHttpMessageConverter");

    assertConverterBeanRegisteredWithHttpMessageConverters(
            GsonHttpMessageConverter.class);
}
项目:spring-boot-concourse    文件:HttpMessageConvertersAutoConfigurationTests.java   
@Test
public void jacksonIsPreferredByDefaultWhenBothGsonAndJacksonAreAvailable() {
    this.context.register(GsonAutoConfiguration.class, JacksonAutoConfiguration.class,
            HttpMessageConvertersAutoConfiguration.class);
    this.context.refresh();
    assertConverterBeanExists(MappingJackson2HttpMessageConverter.class,
            "mappingJackson2HttpMessageConverter");
    assertConverterBeanRegisteredWithHttpMessageConverters(
            MappingJackson2HttpMessageConverter.class);
    assertThat(this.context.getBeansOfType(GsonHttpMessageConverter.class)).isEmpty();
}
项目:spring-boot-concourse    文件:HttpMessageConvertersAutoConfigurationTests.java   
@Test
public void gsonCanBePreferredWhenBothGsonAndJacksonAreAvailable() {
    this.context.register(GsonAutoConfiguration.class, JacksonAutoConfiguration.class,
            HttpMessageConvertersAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.http.converters.preferred-json-mapper:gson");
    this.context.refresh();
    assertConverterBeanExists(GsonHttpMessageConverter.class,
            "gsonHttpMessageConverter");
    assertConverterBeanRegisteredWithHttpMessageConverters(
            GsonHttpMessageConverter.class);
    assertThat(this.context.getBeansOfType(MappingJackson2HttpMessageConverter.class))
            .isEmpty();
}
项目:spring-boot-concourse    文件:HttpMessageConvertersAutoConfigurationTests.java   
@Test
public void customGsonConverter() throws Exception {
    this.context.register(GsonAutoConfiguration.class, GsonConverterConfig.class,
            HttpMessageConvertersAutoConfiguration.class);
    this.context.refresh();
    assertConverterBeanExists(GsonHttpMessageConverter.class,
            "customGsonMessageConverter");

    assertConverterBeanRegisteredWithHttpMessageConverters(
            GsonHttpMessageConverter.class);
}
项目:contestparser    文件:HttpMessageConvertersAutoConfigurationTests.java   
@Test
public void defaultGsonConverter() throws Exception {
    this.context.register(GsonAutoConfiguration.class,
            HttpMessageConvertersAutoConfiguration.class);
    this.context.refresh();
    assertConverterBeanExists(GsonHttpMessageConverter.class,
            "gsonHttpMessageConverter");

    assertConverterBeanRegisteredWithHttpMessageConverters(
            GsonHttpMessageConverter.class);
}
项目:contestparser    文件:HttpMessageConvertersAutoConfigurationTests.java   
@Test
public void jacksonIsPreferredByDefaultWhenBothGsonAndJacksonAreAvailable() {
    this.context.register(GsonAutoConfiguration.class, JacksonAutoConfiguration.class,
            HttpMessageConvertersAutoConfiguration.class);
    this.context.refresh();
    assertConverterBeanExists(MappingJackson2HttpMessageConverter.class,
            "mappingJackson2HttpMessageConverter");
    assertConverterBeanRegisteredWithHttpMessageConverters(
            MappingJackson2HttpMessageConverter.class);
    assertEquals(0,
            this.context.getBeansOfType(GsonHttpMessageConverter.class).size());
}
项目:contestparser    文件:HttpMessageConvertersAutoConfigurationTests.java   
@Test
public void gsonCanBePreferredWhenBothGsonAndJacksonAreAvailable() {
    this.context.register(GsonAutoConfiguration.class, JacksonAutoConfiguration.class,
            HttpMessageConvertersAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.http.converters.preferred-json-mapper:gson");
    this.context.refresh();
    assertConverterBeanExists(GsonHttpMessageConverter.class,
            "gsonHttpMessageConverter");
    assertConverterBeanRegisteredWithHttpMessageConverters(
            GsonHttpMessageConverter.class);
    assertEquals(0, this.context
            .getBeansOfType(MappingJackson2HttpMessageConverter.class).size());
}
项目:contestparser    文件:HttpMessageConvertersAutoConfigurationTests.java   
@Test
public void customGsonConverter() throws Exception {
    this.context.register(GsonAutoConfiguration.class, GsonConverterConfig.class,
            HttpMessageConvertersAutoConfiguration.class);
    this.context.refresh();
    assertConverterBeanExists(GsonHttpMessageConverter.class,
            "customGsonMessageConverter");

    assertConverterBeanRegisteredWithHttpMessageConverters(
            GsonHttpMessageConverter.class);
}