public static FieldScope fromSetFields(Message message) {
    return fromSetFields(
        message, AnyUtils.defaultTypeRegistry(), AnyUtils.defaultExtensionRegistry());
  }
@Test
  public void testFromSetFields_skipNulls() {
    Message message1 = parse("o_int: 1 r_string: \"foo\" r_string: \"bar\"");
    Message eqMessage1 = parse("o_int: 1 r_string: \"foo\" r_string: \"bar\"");
    Message eqIgnoredMessage1 = parse("o_int: 2 r_string: \"foo\" r_string: \"bar\"");
    Message message2 = parse("o_int: 3 r_string: \"baz\" r_string: \"qux\"");
    Message eqMessage2 = parse("o_int: 3 r_string: \"baz\" r_string: \"qux\"");
    Message eqIgnoredMessage2 = parse("o_int: 4 r_string: \"baz\" r_string: \"qux\"");

    List<Message> messages = Lists.newArrayList();
    Message nullMessage = null;
    messages.add(parse("o_int: -1"));
    messages.add(nullMessage);
    messages.add(parse("r_string: \"NaN\""));

    expectThat(listOf(message1, message2))
        .withPartialScope(FieldScopes.fromSetFields(messages))
        .containsExactly(eqMessage1, eqMessage2);
    expectThat(listOf(message1, message2))
        .withPartialScope(
            FieldScopes.fromSetFields(parse("o_int: -1"), nullMessage, parse("r_string: \"NaN\"")))
        .containsExactly(eqMessage1, eqMessage2);

    expectFailureWhenTesting()
        .that(listOf(message1, message2))
        .withPartialScope(FieldScopes.fromSetFields(messages))
        .containsExactly(eqIgnoredMessage1, eqIgnoredMessage2);
    expectThatFailure()
        .factValue("testing whether")
        .contains(
            "is equivalent according to "
                + "assertThat(proto)"
                + ".withPartialScope("
                + "FieldScopes.fromSetFields(["
                + "{o_int: -1\n}, null, {r_string: \"NaN\"\n}]))"
                + ".isEqualTo(target)");

    expectFailureWhenTesting()
        .that(listOf(message1, message2))
        .withPartialScope(
            FieldScopes.fromSetFields(parse("o_int: -1"), nullMessage, parse("r_string: \"NaN\"")))
        .containsExactly(eqIgnoredMessage1, eqIgnoredMessage2);
    expectThatFailure()
        .factValue("testing whether")
        .contains(
            "is equivalent according to "
                + "assertThat(proto)"
                + ".withPartialScope("
                + "FieldScopes.fromSetFields(["
                + "{o_int: -1\n}, null, {r_string: \"NaN\"\n}]))"
                + ".isEqualTo(target)");
  }