public static FieldScope ignoringFields(int firstFieldNumber, int... rest) {
    return FieldScopeImpl.createIgnoringFields(asList(firstFieldNumber, rest));
  }
@Test
  public void testInvalidFieldNumber() {
    Message message1 = parse("o_int: 44");
    Message message2 = parse("o_int: 33");

    try {
      assertThat(message1).ignoringFields(999).isEqualTo(message2);
      fail("Expected failure.");
    } catch (Exception expected) {
      // TODO(user): Use hasTransitiveCauseThat() if/when it becomes available.

      Throwable cause = expected;
      while (cause != null) {
        if (cause
            .getMessage()
            .contains("Message type " + fullMessageName() + " has no field with number 999.")) {
          break;
        } else {
          cause = cause.getCause();
        }
      }
      if (cause == null) {
        fail("No cause with field number error message.");
      }
    }
  }