Class ProtoMatchers


  • public class ProtoMatchers
    extends Object
    Matchers for proto buffers.
    • Constructor Detail

      • ProtoMatchers

        public ProtoMatchers()
    • Method Detail

      • equalToMessage

        public static <M extends com.google.protobuf.Message> org.hamcrest.Matcher<M> equalToMessage​(M expected,
                                                                                                     String... ignoring)
        Expect a message, with optional fields to be ignored. Ignored fields will both be ignored in comparison and in diff output.
        Type Parameters:
        M - Message type.
        Parameters:
        expected - Expected message.
        ignoring - Ignored fields. This is a set of field paths following the same path spec as in FieldMask.
        Returns:
        The matcher.
      • equalToMessageIgnoreExtensions

        public static <M extends com.google.protobuf.Message> org.hamcrest.Matcher<M> equalToMessageIgnoreExtensions​(M expected,
                                                                                                                     String... ignoring)
        Expect a message, with optional fields to be ignored. Ignored fields will both be ignored in comparison and in diff output. Also ignoring all extensions.
        Type Parameters:
        M - Message type.
        Parameters:
        expected - Expected message.
        ignoring - Ignored fields. This can be any field descriptor, including extensions.
        Returns:
        The matcher.