@Override
  public void hasAllRequiredFields() {
    if (!actual.isInitialized()) {
      failWithoutActual(
          simpleFact("expected to have all required fields set"),
          fact("but was missing", actual.findInitializationErrors()),
          fact("proto was", actualCustomStringRepresentationForProtoPackageMembersToCall()));
    }
  }
@Test
  public void testHasAllRequiredFields() {
    // Proto 3 doesn't have required fields.
    if (isProto3()) {
      return;
    }

    expectThat(parsePartial("")).hasAllRequiredFields();
    expectThat(parsePartial("o_required_string_message: { required_string: \"foo\" }"))
        .hasAllRequiredFields();

    expectFailureWhenTesting()
        .that(parsePartial("o_required_string_message: {}"))
        .hasAllRequiredFields();
    expectThatFailure()
        .factKeys()
        .containsExactly(
            "expected to have all required fields set", "but was missing", "proto was");
    expectThatFailure()
        .factValue("but was missing")
        .isEqualTo("[o_required_string_message.required_string]");

    expectFailureWhenTesting()
        .that(parsePartial("r_required_string_message: {} r_required_string_message: {}"))
        .hasAllRequiredFields();
    expectThatFailure()
        .factKeys()
        .containsExactly(
            "expected to have all required fields set", "but was missing", "proto was");
    expectThatFailure()
        .factValue("but was missing")
        .contains("r_required_string_message[0].required_string");
    expectThatFailure()
        .factValue("but was missing")
        .contains("r_required_string_message[1].required_string");
  }