ServiceFactory { public static ObjectMapper getObjectMapper() { return LazyMapperHolder.MAPPER; } ServiceFactory();   ServiceFactory(HttpClientFactory httpClientFactory); static ObjectMapper getObjectMapper(); HttpClient createHttpClient(boolean useProxy, String proxyHost, int proxyPort);  }
@Test public void testObjectMapperIsConfigured() throws IOException { JsonBean expBean = new JsonBean(); expBean.setName("test"); expBean.setAge(42); ObjectMapper mapper = ServiceFactory.getObjectMapper(); assertThat(mapper).isNotNull(); JsonBean bean = mapper.readValue(getClass().getResource("/testPerson.json"), JsonBean.class); assertThat(bean).isEqualTo(expBean); }
@Test public void testObjectMapperIsCached() { ObjectMapper mapper1 = ServiceFactory.getObjectMapper(); ObjectMapper mapper2 = ServiceFactory.getObjectMapper(); assertThat(mapper2).isSameAs(mapper1); }