Skip to content

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

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.

Provide an interface for collecting exceptions

1 participant