public static String toJson(UpdateRequirement updateRequirement) {
    return toJson(updateRequirement, false);
  }
@Test
  public void testAssertRefSnapshotIdFromJsonWithNullSnapshotId() {
    String requirementType = UpdateRequirementParser.ASSERT_REF_SNAPSHOT_ID;
    String refName = "snapshot-name";
    Long snapshotId = null;
    String expected =
        String.format(
            "{\"type\":\"%s\",\"ref\":\"%s\",\"snapshot-id\":%d}",
            requirementType, refName, snapshotId);
    UpdateRequirement actual = new UpdateRequirement.AssertRefSnapshotID(refName, snapshotId);
    assertThat(UpdateRequirementParser.toJson(actual))
        .as("AssertRefSnapshotId should convert to the correct JSON value")
        .isEqualTo(expected);
  }