@Override
  public void setPartitionDataUsingJson(String partitionDataJson)
      throws IOException
  {
    Map<Integer, Double> rawObject =
        JacksonUtil.getObjectMapper().readValue(partitionDataJson, new TypeReference<HashMap<Integer, Double>>(){});
    Map<Integer, PartitionData> partitionDataMap = new HashMap<>();
    for (Map.Entry<Integer, Double> entry : rawObject.entrySet())
    {
      PartitionData data = new PartitionData(entry.getValue());
      partitionDataMap.put(entry.getKey(), data);
    }
    _announcer.setPartitionData(partitionDataMap);
  }
@Test
  public void setPartitionDataUsingJson() throws IOException
  {
    final Map<Integer,Double> partitionDataExpected = new HashMap<>();
    partitionDataExpected.put(1, 0.9);
    partitionDataExpected.put(2, 1.5);
    partitionDataExpected.put(29, 3.5);

    _zooKeeperAnnouncerJmx.setPartitionDataUsingJson(PARTITION_DATA_JSON);

    final Map<Integer, PartitionData> deserializedPartitionData = _zooKeeperAnnouncerJmx.getPartitionData();

    Assert.assertNotNull(deserializedPartitionData);
    Assert.assertEquals(deserializedPartitionData.size(), 3);
    for (Map.Entry<Integer,PartitionData> entry : deserializedPartitionData.entrySet())
    {
      Assert.assertTrue(partitionDataExpected.containsKey(entry.getKey()));
      PartitionData partitionData = deserializedPartitionData.get(entry.getKey());
      Assert.assertNotNull(partitionData);
      Assert.assertEquals(partitionDataExpected.get(entry.getKey()), (Double) partitionData.getWeight());
    }
  }