Skip to content

Commit

Permalink
Make ProtoSubject not extend ProtoFluentAssertion.
Browse files Browse the repository at this point in the history
This brings ProtoSubject in line with IterableOfProtosSubject and the other types in its package.

[]

RELNOTES=Changed `ProtoSubject` to not extend `ProtoFluentAssertion`. It still contains all the same methods, except that `isEqualTo` and `isNotEqualTo` now require a `Message`, rather than accept any `Object`.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=254981746
  • Loading branch information
cpovirk committed Jun 25, 2019
1 parent fe2c8c4 commit 777af33
Show file tree
Hide file tree
Showing 2 changed files with 571 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Fluent API to perform detailed, customizable comparison of Protocol buffers.
*
* <p>Methods may be chained in any order, but the chain should terminate with {@link
* #isEqualTo(Object)} or {@link #isNotEqualTo(Object)}.
* #isEqualTo(Message)} or {@link #isNotEqualTo(Message)}.
*
* <p>The state of a {@code ProtoFluentAssertion} object after each method is called is left
* undefined. Users should not retain references to {@code ProtoFluentAssertion} instances.
Expand Down Expand Up @@ -357,8 +357,8 @@ ProtoFluentAssertion usingFloatToleranceForFieldDescriptors(
* expected protos.
*
* <p>The "expected proto(s)" are those passed to the void method at the end of the {@code
* ProtoFluentAssertion} call-chain: For example, {@link #isEqualTo(Object)}, or {@link
* #isNotEqualTo(Object)}.
* ProtoFluentAssertion} call-chain: For example, {@link #isEqualTo(Message)}, or {@link
* #isNotEqualTo(Message)}.
*
* <p>Fields not set in the expected proto(s) are ignored. In particular, proto3 fields which have
* their default values are ignored, as these are indistinguishable from unset fields. If you want
Expand Down Expand Up @@ -458,18 +458,18 @@ ProtoFluentAssertion ignoringFieldDescriptors(
* earlier operations. If no settings are changed, this invokes the default {@code equals}
* implementation of the subject {@link Message}.
*/
void isEqualTo(@NullableDecl Object expected);
void isEqualTo(@NullableDecl Message expected);

/**
* Compares the subject of the assertion to {@code expected}, expecting a difference, using all of
* the rules specified by earlier operations. If no settings are changed, this invokes the default
* {@code equals} implementation of the subject {@link Message}.
*/
void isNotEqualTo(@NullableDecl Object expected);
void isNotEqualTo(@NullableDecl Message expected);

/**
* @deprecated Do not call {@code equals()} on a {@code ProtoFluentAssertion}. Use {@link
* #isEqualTo(Object)} instead.
* #isEqualTo(Message)} instead.
* @see com.google.common.truth.Subject#equals(Object)
*/
@Override
Expand All @@ -478,7 +478,7 @@ ProtoFluentAssertion ignoringFieldDescriptors(

/**
* @deprecated {@code ProtoFluentAssertion} does not support {@code hashCode()}. Use {@link
* #isEqualTo(Object)} for testing.
* #isEqualTo(Message)} for testing.
* @see com.google.common.truth.Subject#hashCode()
*/
@Override
Expand Down
Loading

0 comments on commit 777af33

Please sign in to comment.