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.
This requires adapting to Truth's recent nullness annotations.
Specifically, a
Subject
constructor (and the associatedSubject.Factory
andassertThat
function) should accept a null actualvalue. By doing so, it makes it possible to write
assertThat(foo).isNull()
, for example.This does not necessarily mean that all assertions will pass if the caller
passes
null
. ObviouslyisNotNull()
will fail, of course, but so too mayother assertions, like
hasFoundProducts
will here.(In principle, it would be nice for all assertions to fail with
detailed
NullPointerException
messages. In practice, we mostlyhaven't done that even for the core Truth assertions. So I haven't here,
either.)
Without this PR, the error that Truth 1.4.2 produces is:
Fixes #5191