Skip to content

Modernize exception assertions in BaseTaskExecutionDaoTestCases - #1041

Open
siddiqueirshad wants to merge 1 commit into
spring-cloud:mainfrom
siddiqueirshad:modernize-dao-exception-tests
Open

siddiqueirshad wants to merge 1 commit into
spring-cloud:mainfrom
siddiqueirshad:modernize-dao-exception-tests

Conversation

@siddiqueirshad

Copy link
Copy Markdown

Motivation / Summary

This pull request modernizes exception assertions in BaseTaskExecutionDaoTestCases by transitioning legacy try / catch / fail boilerplate to standard AssertJ fluent assertions using assertThatThrownBy(...).

Changes Made

  • In BaseTaskExecutionDaoTestCases:
    • getLatestTaskExecutionsByTaskNamesWithNullParameter: modernized with assertThatThrownBy.
    • getLatestTaskExecutionsByTaskNamesWithEmptyArrayParameter: modernized with assertThatThrownBy.
    • getLatestTaskExecutionsByTaskNamesWithArrayParametersContainingNullAndEmptyValues: modernized with assertThatThrownBy.
    • getLatestTaskExecutionForTaskNameWithNullParameter: modernized with assertThatThrownBy.
    • getLatestTaskExecutionForTaskNameWithEmptyStringParameter: modernized with assertThatThrownBy.
  • Replaced unused fail static import with assertThatThrownBy.

@siddiqueirshad
siddiqueirshad force-pushed the modernize-dao-exception-tests branch from 52bc9e8 to cbf779b Compare November 2, 2026 15:27
return;
}
fail("Expected an IllegalArgumentException to be thrown.");
assertThatThrownBy(() -> this.dao.getLatestTaskExecutionsByTaskNames(null))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the tests to use assertThatIllegalArgumentException to be a little more concise.

@cppwfs

cppwfs commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Thank you for your contribution!

@siddiqueirshad

Copy link
Copy Markdown
Author

Hi @cppwfs, thank you for the review! I have updated all five tests to use �ssertThatIllegalArgumentException().isThrownBy(...).withMessage(...) to make them more concise as requested.

@cppwfs

cppwfs commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Can you please follow sign your commit according to our DCO policy found here: https://spring.io/blog/2025/01/06/hello-dco-goodbye-cla-simplifying-contributions-to-spring

Thanks!

Signed-off-by: siddiqui irshad <mohdirshad1306@gmail.com>
@siddiqueirshad
siddiqueirshad force-pushed the modernize-dao-exception-tests branch from f40896b to 34dfb71 Compare November 4, 2026 18:35

This branch has not been deployed

No deployments
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.

2 participants