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

Improved execution of grouped assertions #15990

Merged
merged 2 commits into from
Apr 8, 2021
Merged

Conversation

eas5
Copy link
Contributor

@eas5 eas5 commented Mar 24, 2021

Problem:
A test method with many individual assertions stops being executed on the first failed assertion, which prevents the remaining ones' execution.

Solution:
Using JUnit's grouped assertions feature, all assertions are executed, and all failures will be reported together. In this refactoring, no original assertion was changed.

Result:
Before:

assertEquals("io.quarkus.agroal", Capability.AGROAL.getName());
assertEquals("io.quarkus.security.jpa", Capability.SECURITY_JPA.getName());
assertEquals("io.quarkus.container.image.docker", Capability.CONTAINER_IMAGE_DOCKER.getName());

After:

assertAll(
        () -> assertEquals("io.quarkus.agroal", Capability.AGROAL.getName()),
        () -> assertEquals("io.quarkus.security.jpa", Capability.SECURITY_JPA.getName()),
        () -> assertEquals("io.quarkus.container.image.docker", Capability.CONTAINER_IMAGE_DOCKER.getName())
);

Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

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

It's indeed a good idea.

@gsmet gsmet merged commit e21d31a into quarkusio:main Apr 8, 2021
@quarkus-bot quarkus-bot bot added this to the 2.0 - main milestone Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants