Closed victorolinasc closed 6 years ago
I agree, and that's a excellent suggestion, thank you! What do you think about this variation?
// V3 proposal
// Validating
sentIntent {
action(Intent.ACTION_VIEW)
}
// Stubbing
stubIntent {
action(Intent.ACTION_VIEW)
} respondWithOk { // or respondWithCanceled {} or respondWith(code) {}
setAction(Intent.ACTION_VIEW)
setData(/*...*/)
// ...
}
@victorolinasc https://github.com/heitorcolangelo/kappuccino/pull/96
@victorolinasc do you mind in close your issue? 😁
SOrry!
Current behaviour is to detect if a
matchIntent
is intending or intended by the contents of the clojure: whether it uses the result methods will decide upon its use.I think this is a bit confusing and more implicit than explicit. I understand that both methods take a
Matcher<Intent>
parameter though they are meant for different things. Even the name match is not exactly what it does: it matches to either validate or stub (as per Espresso docs). So, in my opinion we could have a different DSL here. Something like:(I am not too sure how we could elegantly populate the intent. Perhaps follow the "anko" way here would be the best alternative...).
The proposals try to be closer to the espresso intentions and perhaps ease future additions to this API. I prefer V1 IMHO.
Please, feel free to say this makes no sense :)