@Override
  public void isEqualTo(@Nullable Object expected) {
    if (sameClassMessagesWithDifferentDescriptors(actual, expected)) {
      // This can happen with DynamicMessages, and it's very confusing if they both have the
      // same string.
      failWithoutActual(
          simpleFact("Not true that messages compare equal; they have different descriptors."),
          fact("expected", expected),
          fact("with descriptor", ((Message) expected).getDescriptorForType()),
          fact("but was", actual),
          fact("with descriptor", actual.getDescriptorForType()));
    } else if (notMessagesWithSameDescriptor(actual, expected)) {
      super.isEqualTo(expected);
    } else {
      DiffResult diffResult =
          makeDifferencer((Message) expected).diffMessages(actual, (Message) expected);
      if (!diffResult.isMatched()) {
        failWithoutActual(
            simpleFact(
                "Not true that messages compare equal.\n"
                    + diffResult.printToString(config.reportMismatchesOnly())));
      }
    }
  }
@Test
  public void testMapWithDefaultKeysAndValues() throws InvalidProtocolBufferException {
    Descriptor descriptor = getFieldDescriptor("o_int").getContainingType();
    String defaultString = "";
    int defaultInt32 = 0;
    Message message = makeProtoMap(ImmutableMap.of(defaultString, 1, "foo", defaultInt32));
    Message dynamicMessage =
        DynamicMessage.parseFrom(
            descriptor, message.toByteString(), ExtensionRegistry.getEmptyRegistry());
    expectThat(message).isEqualTo(dynamicMessage);
  }