Skip to content

Introduce ExceptionCollector Interface for Cross-Framework Exception Collection #162

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

YongGoose
Copy link

Overview

This PR introduces ExceptionCollector, a unified interface for collecting exceptions across testing frameworks (JUnit / TestNG / AssertJ / Mockito / etc). It enables soft assertions and centralized failure reporting while maintaining framework interoperability.

Key Features

  • Provides a standard way to collect multiple exceptions during test execution and report them together at the end.
  • Supports integration with various frameworks using an adapter pattern via the adapt() method.
  • Offers methods like checkThat() and checkSucceeds() for soft assertion and safe execution.

Example Usage

// Unified exception collection  
ExceptionCollector collector = new DefaultExceptionCollector();  

// Cross-framework assertions  
collector.adapt(JUnitAdapter.class).assertEqual(actual, expected);  
collector.adapt(AssertJAdapter.class).assertThat(list).isEmpty();  

// Final failure report  
collector.reportCollectedExceptions(); // Throws MultipleFailuresError  

resolves #3

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide an interface for collecting exceptions
1 participant