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

    try {
      FieldScopes.fromSetFields(
          TestMessage2.newBuilder().setOInt(2).build(),
          TestMessage3.newBuilder().setOInt(2).build());
      fail("Expected failure.");
    } catch (RuntimeException expected) {
      expect
          .that(expected)
          .hasMessageThat()
          .contains("Cannot create scope from messages with different descriptors");
      expect.that(expected).hasMessageThat().contains(TestMessage2.getDescriptor().getFullName());
      expect.that(expected).hasMessageThat().contains(TestMessage3.getDescriptor().getFullName());
    }
  }