@Test
public void testGetCacheKeyForException() throws Exception {

  ObjectMapper jmxObjectMapper = new ObjectMapper();
  jmxObjectMapper.configure(DeserializationConfig.Feature.USE_ANNOTATIONS, false);
  ObjectReader jmxObjectReader = jmxObjectMapper.reader(JMXMetricHolder.class);
  List<Exception> exceptions = new ArrayList<>();
  for (int i = 0; i < 2; i++) {
    try{
      jmxObjectReader.readValue("Invalid string");
    } catch (Exception e) {
      // Exception messages will be different with each iteration.
      exceptions.add(e);
    }
  }
  Assert.assertEquals(ThreadPoolEnabledPropertyProvider.getCacheKeyForException(exceptions.get(0)),
      ThreadPoolEnabledPropertyProvider.getCacheKeyForException(exceptions.get(1)));
}