@Test
public void offsetHighwaterMark() {

  ArgumentCaptor<SettableGauge> gauge = ArgumentCaptor.forClass(SettableGauge.class);
  when(metricRegistry.register(eq("partition.0.highwater-mark"), gauge.capture())).thenReturn(null);
  new Metrics(metricRegistry).offsetHighwaterMark(0, 1L);
  verify(metricRegistry).register(eq("partition.0.highwater-mark"), gauge.capture());
  assertThat(gauge.getValue().getValue(), is(1L));
}