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 testFailParsingWhenNullOrEmptyJson() {
    String nullJson = null;
    assertThatThrownBy(() -> SnapshotRefParser.fromJson(nullJson))
        .isInstanceOf(IllegalArgumentException.class)
        .hasMessageStartingWith("Cannot parse snapshot ref from invalid JSON");

    String emptyJson = "";
    assertThatThrownBy(() -> SnapshotRefParser.fromJson(emptyJson))
        .isInstanceOf(IllegalArgumentException.class)
        .hasMessageStartingWith("Cannot parse snapshot ref from invalid JSON");
  }