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

Provide an interface for collecting exceptions #3

Open
kcooney opened this issue Dec 15, 2015 · 5 comments
Open

Provide an interface for collecting exceptions #3

kcooney opened this issue Dec 15, 2015 · 5 comments
Assignees

Comments

@kcooney
Copy link

kcooney commented Dec 15, 2015

It would be useful to provide an interface that could be implemented by classes like org.junit.rules.ErrorCollector. This could be useful for libraries like Truth.

We should consider giving the interface a signature compatible with java.util.function.Consumer.

@sbrannen sbrannen self-assigned this Dec 15, 2015
@sbrannen
Copy link
Member

Do you mean something as simple as the following?

public interface ExceptionCollector {

    void add(Throwable t);

}

@kcooney
Copy link
Author

kcooney commented Dec 15, 2015

@sbrannen Yes. But we may want to have the same signature as Consumer so it can extend Consumer<Throwable> later.

If you don't feel like Consumer is a good fit, then I suggest naming the method addError() so ErrorCollector can implement it with no API changes.

@kriegfrj
Copy link

kriegfrj commented Mar 6, 2019

+1

Is this issue going anywhere? I'm currently investigating how Mockito's VerificationCollector and AssertJ's SoftAssertions could play nicely together, and I think a common interface like this might be part of the solution.

@sbrannen
Copy link
Member

sbrannen commented Mar 7, 2019

@kriegfrj, this issue dropped off our radar, but now that you bring it up, I think it's something worth considering.

Anyone care to submit a PR to get the ball rolling?

@kriegfrj
Copy link

kriegfrj commented Mar 7, 2019

I made some relevant comments to this issue under assertj/assertj#1459.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants