public static SnapshotRef fromJson(String json) {
    Preconditions.checkArgument(
        json != null && !json.isEmpty(), "Cannot parse snapshot ref from invalid JSON: %s", json);
    return JsonUtil.parse(json, SnapshotRefParser::fromJson);
  }
@Test
  public void testFailParsingWhenMissingRequiredFields() {
    String refMissingType = "{\"snapshot-id\":1}";
    assertThatThrownBy(() -> SnapshotRefParser.fromJson(refMissingType))
        .isInstanceOf(IllegalArgumentException.class)
        .hasMessageStartingWith("Cannot parse missing string");

    String refMissingSnapshotId = "{\"type\":\"branch\"}";
    assertThatThrownBy(() -> SnapshotRefParser.fromJson(refMissingSnapshotId))
        .isInstanceOf(IllegalArgumentException.class)
        .hasMessageStartingWith("Cannot parse missing long");
  }