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

New Feature: AbstractThrowableAssert#message() #2378

Closed
sebthom opened this issue Oct 19, 2021 · 5 comments
Closed

New Feature: AbstractThrowableAssert#message() #2378

sebthom opened this issue Oct 19, 2021 · 5 comments
Assignees
Labels
status: ideal for contribution An issue that a contributor can help us with

Comments

@sebthom
Copy link

sebthom commented Oct 19, 2021

Summary

Please add a shortcut for extracting(Throwable::getMessage, as(InstanceOfAssertFactories.STRING)) to perform assertions on an exception's message (discussed in #2376 (comment)).

Example

Instead of

assertThatThrownBy(() -> {
  /* code to test */
})
  .isInstanceOf(CertPathValidatorException.class)
  .extracting(Throwable::getMessage, as(InstanceOfAssertFactories.STRING))
  .containsAnyOf(
    "could not be determined",
    "could not determine revocation status",
    "revocation status check failed"
  );

one can then use

assertThatThrownBy(() -> {
  /* code to test */
})
  .isInstanceOf(CertPathValidatorException.class)
  .message()
  .containsAnyOf(
    "could not be determined",
    "could not determine revocation status",
    "revocation status check failed"
  );
@scordio scordio added status: ideal for contribution An issue that a contributor can help us with Hacktoberfest labels Oct 19, 2021
@trangntt-016
Copy link
Contributor

trangntt-016 commented Oct 19, 2021

Hi @scordio , I'm interested in this feature. Can you please assign this to me?

@sebthom
Copy link
Author

sebthom commented Oct 19, 2021

@trangntt-016 I am not a member of the organization, so I cannot assign the issue to you. @scordio ?

@scordio
Copy link
Member

scordio commented Oct 19, 2021

Thank you both, issue assigned.

@iamdebojyoti
Copy link

Hi @trangntt-016, Are you still working on this issue? If not, can I work on this one?

@trangntt-016
Copy link
Contributor

Hi @iamdebojyoti ,

Yes I'm still working on this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ideal for contribution An issue that a contributor can help us with
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants