Prepare StreamSubject
for adding Truth.assertThat(Stream)
.
#1220
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prepare
StreamSubject
for addingTruth.assertThat(Stream)
.At that point, some calls to
assertThat(Object)
will become calls to the new overload. That would be a problem if:isEqualTo
orisNotEqualTo
, which we've turned into throwing@DoNotCall
methodsStream
or they want to operate on theStream
afterwardThis CL makes
isEqualTo
andisNotEqualTo
"work" (though it leaves them deprecated, since they're still a bad idea), and it avoids collecting theStream
until necessary.The
isEqualTo
change requires some weird plumbing because I made its failure message retain our warning aboutStream.equals
. That requires creating a newStreamSubject
with a differentFailureMetadata
instance, which isn't the kind of thing we normally do. (We've done something similar inThrowableSubject
, but it is simpler because (a)ThrowableSubject
uses the "normal" (i.e.., non-no-arg)check
and (b)ThrowableSubject
doesn't have to worry about avoiding re-collecting aStream
.)We may want to clamp back down on
isEqualTo
in the future. I've set myself a calendar reminder for mid-year. For now, I just want to makeassertThat(Stream)
, which will already be mildly disruptive, from being even more disruptive.(progress toward #746)
RELNOTES=Made
StreamSubject
avoid collecting theStream
until necessary, and made itsisEqualTo
andisNotEqualTo
methods no longer always throw.