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

Can Truth assert a method throw exception? #1292

Closed
ruanwenjun opened this issue May 10, 2024 · 1 comment
Closed

Can Truth assert a method throw exception? #1292

ruanwenjun opened this issue May 10, 2024 · 1 comment

Comments

@ruanwenjun
Copy link

Hi team,

I didn't find how to assert exception in Truth, where can I find the doc or it doesn't support.

@cpovirk
Copy link
Member

cpovirk commented May 10, 2024

So far, we have suggested that users use support for this in their test library, such as JUnit's assertThrows or kotlin.tests's assertFailsWith. It's a good point that we should write that down somewhere. There may be test libraries that don't have an equivalent, though. And we do have some ideas for how Truth could improve upon those. Still, so far, it hasn't been clearly worthwhile enough for us to provide our own version. You can follow along on #621 (and share any other thoughts of your own), and I'll see about finally at least documenting this. Thanks for raising it.

@cpovirk cpovirk closed this as completed May 10, 2024
copybara-service bot pushed a commit that referenced this issue May 13, 2024
#1292

RELNOTES=n/a
PiperOrigin-RevId: 632482116
copybara-service bot pushed a commit that referenced this issue May 13, 2024
#1292

RELNOTES=n/a
PiperOrigin-RevId: 633264611
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants