use of com.fasterxml.jackson.module.guice.ObjectMapperModule in project api-core by ca-cwds.
the class ObjectMapperModuleTest method testModulesRegisteredThroughInjectionWithKey.
@Test
public void testModulesRegisteredThroughInjectionWithKey() throws Exception {
final Injector injector = Guice.createInjector(new ObjectMapperModule().registerModule(Key.get(IntegerAsBase16Module.class)));
final ObjectMapper mapper = injector.getInstance(ObjectMapper.class);
Assert.assertEquals(mapper.writeValueAsString(new Integer(10)), "\"A\"");
}
use of com.fasterxml.jackson.module.guice.ObjectMapperModule in project api-core by ca-cwds.
the class ObjectMapperModuleTest method testModulesRegisteredThroughInjection.
@Test
public void testModulesRegisteredThroughInjection() throws Exception {
final Injector injector = Guice.createInjector(new ObjectMapperModule().registerModule(IntegerAsBase16Module.class));
final ObjectMapper mapper = injector.getInstance(ObjectMapper.class);
Assert.assertEquals(mapper.writeValueAsString(new Integer(10)), "\"A\"");
}
use of com.fasterxml.jackson.module.guice.ObjectMapperModule in project druid by druid-io.
the class S3InputSourceTest method createS3ObjectMapper.
public static ObjectMapper createS3ObjectMapper() {
DruidModule baseModule = new TestS3Module();
final Injector injector = Guice.createInjector(new ObjectMapperModule(), baseModule, new DruidModule() {
@Provides
public AWSCredentialsProvider getAWSCredentialsProvider() {
return AWSCredentialsUtils.defaultAWSCredentialsProviderChain(null);
}
@Override
public List<? extends Module> getJacksonModules() {
return Collections.emptyList();
}
@Override
public void configure(Binder binder) {
}
});
final ObjectMapper baseMapper = injector.getInstance(ObjectMapper.class);
baseModule.getJacksonModules().forEach(baseMapper::registerModule);
return baseMapper;
}
use of com.fasterxml.jackson.module.guice.ObjectMapperModule in project druid by druid-io.
the class OssInputSourceTest method createObjectMapper.
public static ObjectMapper createObjectMapper() {
DruidModule baseModule = new TestOssModule();
final Injector injector = Guice.createInjector(new ObjectMapperModule(), baseModule);
final ObjectMapper baseMapper = injector.getInstance(ObjectMapper.class);
baseModule.getJacksonModules().forEach(baseMapper::registerModule);
return baseMapper;
}
use of com.fasterxml.jackson.module.guice.ObjectMapperModule in project druid by druid-io.
the class StaticCloudFilesFirehoseFactoryTest method createObjectMapper.
private static ObjectMapper createObjectMapper(DruidModule baseModule) {
final ObjectMapper baseMapper = new DefaultObjectMapper();
baseModule.getJacksonModules().forEach(baseMapper::registerModule);
final Injector injector = Guice.createInjector(new ObjectMapperModule(), baseModule);
return injector.getInstance(ObjectMapper.class);
}
Aggregations