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

[SHRINKRES-342] Migrate to JUnit5 #241

Merged
merged 3 commits into from
Sep 13, 2024

Conversation

xjusko
Copy link
Contributor

@xjusko xjusko commented Aug 6, 2024

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.*;
Copy link
Member

Choose a reason for hiding this comment

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

No wildcard imports please

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have missed that. All the occurrences should be fixed.

@@ -1,19 +1,3 @@
/*
Copy link
Member

Choose a reason for hiding this comment

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

Why was this removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was not intentional, probably some random input from my keyboard... Thanks for noticing it.

System.setProperty(MavenSettingsBuilder.ALT_MAVEN_OFFLINE, "true");
@Test
void overrideOfflineFlag() {
System.setProperty(MavenSettingsBuilder.ALT_MAVEN_OFFLINE, "true");
Copy link
Member

Choose a reason for hiding this comment

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

The problem I see in this change is that in case of a test failure the property is still set and might affect other tests either in this testsuite or somewhere else (as it's a system property). I'd propose to change this testsuite in this PR and create a proper cleanup method AfterEach

Assertions.assertThrows(NoResolvedResultException.class, () -> {
Maven.configureResolver().fromFile("target/settings/profiles/settings-jetty.xml")
.resolve("junit:junit:3.8.2").withTransitivity().as(File.class);
Assertions.fail("Artifact junit:junit:3.8.2 should not be present in local repository");
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this Assertions.fail redundant?

pom.xml Outdated
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
Copy link
Member

Choose a reason for hiding this comment

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

I believe Hamcrest released a new version 3.0, can that be used?

@petrberan
Copy link
Member

Good job @xjusko , just a couple of things I noticed and one rebase and I believe we can merge this

@xjusko xjusko force-pushed the migrate-to-junit5 branch 2 times, most recently from a72907e to d619cb6 Compare August 22, 2024 11:06
Copy link
Member

@petrberan petrberan left a comment

Choose a reason for hiding this comment

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

LGTM, thx @xjusko

@petrberan petrberan merged commit 46313a4 into shrinkwrap:master Sep 13, 2024
2 checks passed
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