-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
Default Result Assertions Fix (again) #1429
Conversation
// @Test | ||
// fun toBeAFailureResultFix() { | ||
// val message = "wrong argument" | ||
// val failure = Result.failure<Int>(IllegalArgumentException(message)) | ||
// | ||
// | ||
// | ||
// expect(failure) { | ||
// toBeAFailure<IllegalArgumentException>() | ||
// } | ||
// | ||
// | ||
// } | ||
// |
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.
remove this
// @Test | ||
// fun toBeAFailureFeature() { | ||
// val message = "wrong argument" |
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.
uncomment all the tests instead
// { apply { toBeAFailure.invoke(this) {} } } | ||
// ) | ||
// ) {}) | ||
//TODO 0.20.0 activate once we have the workaround for #1234 implemented |
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.
remove todo
// } | ||
// } | ||
// } | ||
//TODO 0.20.0 activate once we have the workaround for #1234 implemented |
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.
remove todo
val maybeSubjectResult = container.maybeSubject.map { | ||
onSuccess { null } | ||
onFailure { it.cause } | ||
} |
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.
sorry, I did not really find the time beforehand to take a proper look. This code does nothign as your onSuccess and onFailure only perform side effects. They don't return something which means, maybeSubjectResult is the same as container.maybeSubject
. You don't have to do anything. I will improve the code and let you know my result in the end
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.
Ah I see the error I made sorry about that. Would the solution to be to return some sort of value from the success or failure states and check that?
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.
the statement doesn't do anything and you still have fixed the issue which means these lines we can just delete :)
I confirm that I have read the Contributor Agreements v1.0, agree to be bound on them and confirm that my contribution is compliant.