static CounterResult fromJson(String json) {
    return JsonUtil.parse(json, CounterResultParser::fromJson);
  }
@Test
  public void missingFields() {
    assertThatThrownBy(() -> CounterResultParser.fromJson("{}"))
        .isInstanceOf(IllegalArgumentException.class)
        .hasMessage("Cannot parse missing string: unit");

    assertThatThrownBy(() -> CounterResultParser.fromJson("{\"unit\":\"bytes\"}"))
        .isInstanceOf(IllegalArgumentException.class)
        .hasMessage("Cannot parse missing long: value");
  }