@Test
public void testToJSONObject() {

	HistogramMetric histogramMetric = new HistogramMetric(
		new Date(), RandomTestUtil.randomDouble());
	HistoricalMetric historicalMetric = new HistoricalMetric(
		Collections.singletonList(histogramMetric),
		RandomTestUtil.randomDouble());
	JSONObject jsonObject = historicalMetric.toJSONObject();
	Assert.assertEquals(
		JSONUtil.put(
			"histogram",
			JSONUtil.put(
				JSONUtil.put(
					"key", _formatDate(histogramMetric.getKey())
				).put(
					"value", histogramMetric.getValue()
				))
		).put(
			"value", historicalMetric.getValue()
		).toJSONString(),
		jsonObject.toJSONString());
}