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

Consolidate intercept #5033

Merged
merged 3 commits into from
May 24, 2021
Merged

Conversation

ismaelhamed
Copy link
Member

Currently there are a few Intercept methods included in AkkaSpec, but they lack cohesion in their implementations. This PR aims at solving this by consolidating all of them under a single one that also overcome their biggest limitation: not unwrapping AggregateExceptions, which force users to deal with these inside the tests themselves.

This PR also brings along the AssertThrows method (a proper implementation of the Intercept that returns void instead), which should be the preferred between the two when no further inspection of the caught exception is needed.

Hopefully this will make it porting unit tests more straight forward and better aligned with the JVM.

protected async Task InterceptAsync(Func<Task> asyncActionThatThrows)

[Obsolete("Use AssertThrows instead.")]
protected void Intercept(Action actionThatThrows)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping this one since there are a bunch of tests using it, as a catch-all-exceptions, which is dubious at best.

@ismaelhamed
Copy link
Member Author

I meant to open this PR as a Draft, consider it as such.

Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aaronontheweb Aaronontheweb enabled auto-merge (squash) May 24, 2021 13:33
@Aaronontheweb Aaronontheweb disabled auto-merge May 24, 2021 14:17
@Aaronontheweb Aaronontheweb merged commit 99be70b into akkadotnet:dev May 24, 2021
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

Successfully merging this pull request may close these issues.

2 participants