public static FieldScope fromSetFields(Message message) {
    return fromSetFields(
        message, AnyUtils.defaultTypeRegistry(), AnyUtils.defaultExtensionRegistry());
  }
@Test
  public void testFromSetFields_iterables_errorIfDescriptorMismatchesSubject() {
    // Don't run this test twice.
    if (!testIsRunOnce()) {
      return;
    }

    Message message =
        TestMessage2.newBuilder().setOInt(1).addRString("foo").addRString("bar").build();
    Message eqMessage =
        TestMessage2.newBuilder().setOInt(1).addRString("foo").addRString("bar").build();

    try {
      assertThat(message)
          .withPartialScope(
              FieldScopes.fromSetFields(
                  TestMessage3.newBuilder().setOInt(2).build(),
                  TestMessage3.newBuilder().addRString("foo").build()))
          .isEqualTo(eqMessage);
      fail("Expected failure.");
    } catch (RuntimeException expected) {
      expect
          .that(expected)
          .hasMessageThat()
          .contains(
              "Message given to FieldScopes.fromSetFields() "
                  + "does not have the same descriptor as the message being tested");
      expect.that(expected).hasMessageThat().contains(TestMessage2.getDescriptor().getFullName());
      expect.that(expected).hasMessageThat().contains(TestMessage3.getDescriptor().getFullName());
    }
  }