Skip to content

StackTraceElement assertions #2647

Description

@ascopes

Feature summary

I would like to be able to perform assertions on StackTraceElement objects, as well as arrays/lists of StackTraceElement objects. This enables testing exception handling logic for remote execution, as well as exception handling for proxies.

Example

var ex = assertThatCode(() -> doSomethingRemotely())
    .isInstanceOf(SomeRemoteCodeException.class)
    .stackTrace()
    .hasFrameSatisfying(frame -> assertThat(frame).hasClass("com.example.Whatever#doSomethingRemotely"));

...this should be relatively simple as StackTraceElements themselves are just POJOs with a few flat attributes on them.

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions