@Test
  public void test_createDivAggregator() {
    CustomAggregator aggregator = AggregatorFactory.createDivAggregator(60);

    assertThat(aggregator.getName(), equalTo("div"));
    assertThat(aggregator.toJson(), equalTo("{\"name\":\"div\",\"divisor\":60.0}"));
  }
  @Test
  public void test_createCustomAggregator() {
    CustomAggregator aggregator = AggregatorFactory.createCustomAggregator("foobar", "\"foo\": 10");

    assertThat(aggregator.getName(), equalTo("foobar"));
    assertThat(aggregator.toJson(), equalTo("{\"name\":\"foobar\",\"foo\": 10}"));
  }
  @Test
  public void test_createScaleAggregator() {
    CustomAggregator aggregator = AggregatorFactory.createScaleAggregator(0.5);

    assertThat(aggregator.getName(), equalTo("scale"));
    assertThat(aggregator.toJson(), equalTo("{\"name\":\"scale\",\"factor\":0.5}"));
  }
  @Test
  public void test_createTrimAggregator() {
    CustomAggregator aggregator =
        AggregatorFactory.createTrimAggregator(AggregatorFactory.Trim.BOTH);

    assertThat(aggregator.getName(), equalTo("trim"));
    assertThat(aggregator.toJson(), equalTo("{\"name\":\"trim\",\"trim\":\"both\"}"));
  }
  @Test
  public void test_createSaveAsAggregator() {
    CustomAggregator aggregator = AggregatorFactory.createSaveAsAggregator("newMetric");

    assertThat(aggregator.getName(), equalTo("save_as"));
    assertThat(
        aggregator.toJson(), equalTo("{\"name\":\"save_as\",\"metric_name\":\"newMetric\"}"));
  }