-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ComparableSubject#isAtLeast
to Kruth
#519
Conversation
a1558b0
to
222d549
Compare
222d549
to
59a572d
Compare
* @throws NullPointerException if [actual] or [other] is `null`. | ||
*/ | ||
fun isAtLeast(other: T?) { | ||
if (actual == null || other == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use the existing requireNonNull function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can do! The implementation was mostly a copy-paste of the isLessThan
function above. It could perhaps be simplified there too (in a separate PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arkivanov Replacing this line with requireNotNull
would mean an IllegalArgumentException
would be thrown instead of a NullPointerException
. This diverges from Truth, as their isAtLeast
function also throws a NullPointerException
. Was the original suggestion to also change the throwable type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant our internal function, see
internal inline fun <T : Any> requireNonNull( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, my bad! You had linked it in the first message — I completely overlooked it.
Changed in 20d36a6.
To migrate the tests in
paging-common
from Truth to Kruth,isAtLeast
needs to be added to Kruth:androidx/paging/paging-common/src/test/kotlin/androidx/paging/FlowExtTest.kt
Lines 289 to 290 in 72a6b2e
Test: ./gradlew test connectedCheck
Bug: 270612487