Class ProtoTruth
- java.lang.Object
-
- com.google.common.truth.extensions.proto.ProtoTruth
-
public final class ProtoTruth extends Object
A set of static methods to begin a Truth assertion chain for protocol buffers.Note: Usage of different failure strategies such as assume and expect should rely on
StandardSubjectBuilder.about(CustomSubjectBuilder.Factory)
to begin a chain with those alternative behaviors.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <M extends Message>
MultimapWithProtoValuesSubject<M>assertThat(@Nullable Multimap<?,M> multimap)
static ProtoSubject
assertThat(@Nullable Message message)
Assert on a singleMessage
instance.static LiteProtoSubject
assertThat(@Nullable MessageLite messageLite)
Assert on a singleMessageLite
instance.static <M extends Message>
IterableOfProtosSubject<M>assertThat(@Nullable Iterable<M> messages)
Assert on a sequence ofMessage
s.static <M extends Message>
MapWithProtoValuesSubject<M>assertThat(@Nullable Map<?,M> map)
Assert on a map withMessage
values.static CustomSubjectBuilder.Factory<ProtoSubjectBuilder>
protos()
Returns aCustomSubjectBuilder.Factory
, akin to aSubject.Factory
, which can be used to assert on multiple types of Protos and collections containing them.
-
-
-
Method Detail
-
protos
public static CustomSubjectBuilder.Factory<ProtoSubjectBuilder> protos()
Returns aCustomSubjectBuilder.Factory
, akin to aSubject.Factory
, which can be used to assert on multiple types of Protos and collections containing them.
-
assertThat
public static LiteProtoSubject assertThat(@Nullable MessageLite messageLite)
Assert on a singleMessageLite
instance.
-
assertThat
public static ProtoSubject assertThat(@Nullable Message message)
Assert on a singleMessage
instance.
-
assertThat
public static <M extends Message> IterableOfProtosSubject<M> assertThat(@Nullable Iterable<M> messages)
Assert on a sequence ofMessage
s.This allows for the equality configurations on
ProtoSubject
to be applied to all comparison tests available onIterableSubject.UsingCorrespondence
.
-
assertThat
public static <M extends Message> MapWithProtoValuesSubject<M> assertThat(@Nullable Map<?,M> map)
Assert on a map withMessage
values.This allows for the equality configurations on
ProtoSubject
to be applied to all comparison tests available onMapSubject.UsingCorrespondence
.
-
assertThat
public static <M extends Message> MultimapWithProtoValuesSubject<M> assertThat(@Nullable Multimap<?,M> multimap)
Assert on aMultimap
withMessage
values.This allows for the equality configurations on
ProtoSubject
to be applied to all comparison tests available onMultimapSubject.UsingCorrespondence
.
-
-