S
- Subject class type.M
- MessageLite type.@CheckReturnValue public class LiteProtoSubject<S extends LiteProtoSubject<S,M>,M extends com.google.protobuf.MessageLite> extends Subject<S,M>
LiteProtoSubject supports versions 2 and 3 of Protocol Buffers. Due to the lack of runtime descriptors, its functionality is limited compared to ProtoSubject, in particular in performing detailed comparisons between messages.
Modifier and Type | Class and Description |
---|---|
static class |
LiteProtoSubject.Factory<S extends LiteProtoSubject<S,M>,M extends com.google.protobuf.MessageLite>
Typed extension of
Subject.Factory . |
Modifier | Constructor and Description |
---|---|
protected |
LiteProtoSubject(FailureMetadata failureMetadata,
M messageLite) |
Modifier and Type | Method and Description |
---|---|
protected String |
actualCustomStringRepresentation()
Supplies the direct string representation of the actual value to other methods which may prefix
or otherwise position it in an error message.
|
void |
hasAllRequiredFields()
Checks whether the subject has all required fields set.
|
void |
isEqualTo(com.google.protobuf.MessageLite.Builder builder)
Deprecated.
A Builder can never compare equal to a MessageLite instance. Use
build() ,
or buildPartial() on the argument to get a MessageLite for comparison instead. |
void |
isEqualTo(Object expected)
Checks whether the MessageLite is equivalent to the argument, using the standard equals()
implementation.
|
void |
isEqualToDefaultInstance()
Checks whether the subject is a
MessageLite with no fields set. |
void |
isNotEqualTo(com.google.protobuf.MessageLite.Builder builder)
Deprecated.
A Builder will never compare equal to a MessageLite instance. Use
build() ,
or buildPartial() on the argument to get a MessageLite for comparison instead. |
void |
isNotEqualTo(Object expected)
Fails if the subject is equal to the given object.
|
void |
isNotEqualToDefaultInstance()
Checks whether the subject is not equivalent to a
MessageLite with no fields set. |
IntegerSubject |
serializedSize()
Returns an
IntegerSubject on the serialized size of the MessageLite. |
actual, actualAsString, check, check, equals, fail, fail, fail, failComparing, failComparing, failWithActual, failWithActual, failWithBadResults, failWithCustomSubject, failWithoutActual, failWithoutActual, failWithoutSubject, failWithRawMessage, failWithRawMessageAndCause, getSubject, hashCode, ignoreCheck, internalCustomName, isAnyOf, isIn, isInstanceOf, isNoneOf, isNotIn, isNotInstanceOf, isNotNull, isNotSameAs, isNull, isSameAs, named, toString
protected LiteProtoSubject(FailureMetadata failureMetadata, @NullableDecl M messageLite)
protected String actualCustomStringRepresentation()
Subject
Subjects should override this with care.
By default, this returns String.ValueOf(getActualValue())
.
actualCustomStringRepresentation
in class Subject<S extends LiteProtoSubject<S,M>,M extends com.google.protobuf.MessageLite>
public void isEqualTo(@NullableDecl Object expected)
@Deprecated public void isEqualTo(@NullableDecl com.google.protobuf.MessageLite.Builder builder)
build()
,
or buildPartial()
on the argument to get a MessageLite for comparison instead.public void isNotEqualTo(@NullableDecl Object expected)
Subject
Subject.isEqualTo(java.lang.Object)
method.isNotEqualTo
in class Subject<S extends LiteProtoSubject<S,M>,M extends com.google.protobuf.MessageLite>
@Deprecated public void isNotEqualTo(@NullableDecl com.google.protobuf.MessageLite.Builder builder)
build()
,
or buildPartial()
on the argument to get a MessageLite for comparison instead.public void isEqualToDefaultInstance()
MessageLite
with no fields set.public void isNotEqualToDefaultInstance()
MessageLite
with no fields set.public void hasAllRequiredFields()
build()
, which itself fails if required fields aren't set.public IntegerSubject serializedSize()
IntegerSubject
on the serialized size of the MessageLite.
Assertions can then be changed on the serialized size, to support checks such as assertThat(myProto).serializedSize().isAtLeast(16)
, etc.
Copyright © 2018. All rights reserved.