use of com.fasterxml.jackson.databind.cfg.ConstructorDetector in project spring-boot by spring-projects.
the class JacksonAutoConfigurationTests method constructorDetectorWithNoStrategyUseDefault.
@Test
void constructorDetectorWithNoStrategyUseDefault() {
this.contextRunner.run((context) -> {
ObjectMapper mapper = context.getBean(ObjectMapper.class);
ConstructorDetector cd = mapper.getDeserializationConfig().getConstructorDetector();
assertThat(cd.singleArgMode()).isEqualTo(SingleArgConstructor.HEURISTIC);
assertThat(cd.requireCtorAnnotation()).isFalse();
assertThat(cd.allowJDKTypeConstructors()).isFalse();
});
}
use of com.fasterxml.jackson.databind.cfg.ConstructorDetector in project spring-boot by spring-projects.
the class JacksonAutoConfigurationTests method constructorDetectorWithDefaultStrategy.
@Test
void constructorDetectorWithDefaultStrategy() {
this.contextRunner.withPropertyValues("spring.jackson.constructor-detector=default").run((context) -> {
ObjectMapper mapper = context.getBean(ObjectMapper.class);
ConstructorDetector cd = mapper.getDeserializationConfig().getConstructorDetector();
assertThat(cd.singleArgMode()).isEqualTo(SingleArgConstructor.HEURISTIC);
assertThat(cd.requireCtorAnnotation()).isFalse();
assertThat(cd.allowJDKTypeConstructors()).isFalse();
});
}
use of com.fasterxml.jackson.databind.cfg.ConstructorDetector in project spring-boot by spring-projects.
the class JacksonAutoConfigurationTests method constructorDetectorWithUseDelegatingStrategy.
@Test
void constructorDetectorWithUseDelegatingStrategy() {
this.contextRunner.withPropertyValues("spring.jackson.constructor-detector=use-delegating").run((context) -> {
ObjectMapper mapper = context.getBean(ObjectMapper.class);
ConstructorDetector cd = mapper.getDeserializationConfig().getConstructorDetector();
assertThat(cd.singleArgMode()).isEqualTo(SingleArgConstructor.DELEGATING);
assertThat(cd.requireCtorAnnotation()).isFalse();
assertThat(cd.allowJDKTypeConstructors()).isFalse();
});
}
use of com.fasterxml.jackson.databind.cfg.ConstructorDetector in project spring-boot by spring-projects.
the class JacksonAutoConfigurationTests method constructorDetectorWithExplicitOnlyStrategy.
@Test
void constructorDetectorWithExplicitOnlyStrategy() {
this.contextRunner.withPropertyValues("spring.jackson.constructor-detector=explicit-only").run((context) -> {
ObjectMapper mapper = context.getBean(ObjectMapper.class);
ConstructorDetector cd = mapper.getDeserializationConfig().getConstructorDetector();
assertThat(cd.singleArgMode()).isEqualTo(SingleArgConstructor.REQUIRE_MODE);
assertThat(cd.requireCtorAnnotation()).isFalse();
assertThat(cd.allowJDKTypeConstructors()).isFalse();
});
}
use of com.fasterxml.jackson.databind.cfg.ConstructorDetector in project spring-boot by spring-projects.
the class JacksonAutoConfigurationTests method constructorDetectorWithUsePropertiesBasedStrategy.
@Test
void constructorDetectorWithUsePropertiesBasedStrategy() {
this.contextRunner.withPropertyValues("spring.jackson.constructor-detector=use-properties-based").run((context) -> {
ObjectMapper mapper = context.getBean(ObjectMapper.class);
ConstructorDetector cd = mapper.getDeserializationConfig().getConstructorDetector();
assertThat(cd.singleArgMode()).isEqualTo(SingleArgConstructor.PROPERTIES);
assertThat(cd.requireCtorAnnotation()).isFalse();
assertThat(cd.allowJDKTypeConstructors()).isFalse();
});
}
Aggregations