[go: nahoru, domu]

Skip to content
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

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use requireNonNull
  • Loading branch information
veyndan committed Apr 18, 2023
commit 20d36a60ff156846bd7271377b03cab5328940da
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ open class ComparableSubject<T : Comparable<T>> constructor(actual: T?) : Subjec
* @throws NullPointerException if [actual] or [other] is `null`.
*/
fun isAtLeast(other: T?) {
if (actual == null || other == null) {
throw NullPointerException("Expected to be at least $other, but was $actual")
} else if (actual < other) {
requireNonNull(actual) { "Expected to be at least $other, but was $actual" }
requireNonNull(other) { "Expected to be at least $other, but was $actual" }
if (actual < other) {
fail("Expected to be at least $other, but was $actual")
}
}
Expand Down