You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the annotation processor that I am working on, I have run across a case where it is meaningless to report error2 if error1 is detected. Thus as a feature I would like my processor to not output error2 if it has output error1, and I would like to test that my processor is doing the right thing.
Unfortunately the current API doesn't provide for this case easily, as it only allows you to assert the existence of a particular error, or the non-existence of all errors.
In my tests I got around this problem by testing for the existence of error2 using withErrorContaining(), wrapping it in a try/catch, and silently continuing if no AssertionError is caught or else throwing my own AssertionError if it wasn't. However, this is a little ugly and the diagnostics are not as informative as they might be with a "native" implementation in the compile-testing API itself.
In the annotation processor that I am working on, I have run across a case where it is meaningless to report error2 if error1 is detected. Thus as a feature I would like my processor to not output error2 if it has output error1, and I would like to test that my processor is doing the right thing.
Unfortunately the current API doesn't provide for this case easily, as it only allows you to assert the existence of a particular error, or the non-existence of all errors.
In my tests I got around this problem by testing for the existence of error2 using
withErrorContaining()
, wrapping it in a try/catch, and silently continuing if no AssertionError is caught or else throwing my own AssertionError if it wasn't. However, this is a little ugly and the diagnostics are not as informative as they might be with a "native" implementation in the compile-testing API itself.I would like to be able to do something like:
The text was updated successfully, but these errors were encountered: