@Test public void should_init_default_object_factory_mapper() throws Exception { doCallRealMethod().when(extractor).initObjectMapperFactory(configMap); ObjectMapperFactory actual = extractor.initObjectMapperFactory(configMap); assertThat(actual).isNotNull(); ObjectMapper mapper = actual.getMapper(Integer.class); assertThat(mapper).isNotNull(); assertThat(mapper.getSerializationConfig().getSerializationInclusion()) .isEqualTo(Inclusion.NON_NULL); assertThat( mapper .getDeserializationConfig() .isEnabled(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES)) .isFalse(); Collection<AnnotationIntrospector> ais = mapper.getSerializationConfig().getAnnotationIntrospector().allIntrospectors(); assertThat(ais).hasSize(2); Iterator<AnnotationIntrospector> iterator = ais.iterator(); assertThat(iterator.next()) .isInstanceOfAny(JacksonAnnotationIntrospector.class, JaxbAnnotationIntrospector.class); assertThat(iterator.next()) .isInstanceOfAny(JacksonAnnotationIntrospector.class, JaxbAnnotationIntrospector.class); }
@Test public void should_init_object_mapper_factory_from_mapper() throws Exception { configMap.put(OBJECT_MAPPER_PARAM, mapper); doCallRealMethod().when(extractor).initObjectMapperFactory(configMap); ObjectMapperFactory actual = extractor.initObjectMapperFactory(configMap); assertThat(actual).isNotNull(); assertThat(actual.getMapper(Long.class)).isSameAs(mapper); }