Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,19 @@ public void contextClassLoaderTest() throws Exception {

}

@Test
public void testDeprecationWarning() throws Exception {

// verify that JUnit 4 provider shows deprecation warning
Verifier verifier = getVerifier("tycho-surefire-plugin/junit4/bundle.test");

verifier.executeGoal("integration-test");
verifier.verifyErrorFreeLog();

// verify the deprecation warning is logged
verifier.verifyTextInLog("The JUnit 4 test framework provider is deprecated");
verifier.verifyTextInLog("Please migrate to JUnit 5 or use JUnit Vintage");

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -653,10 +653,15 @@ private EquinoxInstallation createProvisionedInstallation() throws MojoExecution
//... if not we notify the caller that nothing has to be done here.
return null;
}
TestFrameworkProvider provider = providerHelper
.selectProvider(project, getProjectType().getClasspath(DefaultReactorProject.adapt(project)),
getMergedProviderProperties(), providerHint)
.provider();
ProviderSelection selection = providerHelper.selectProvider(project,
getProjectType().getClasspath(DefaultReactorProject.adapt(project)),
getMergedProviderProperties(), providerHint);
TestFrameworkProvider provider = selection.provider();
if ("junit4".equals(selection.hint())) {
getLog().warn("The JUnit 4 test framework provider is deprecated and may be removed in a future release. "
+ "Please migrate to JUnit 5 or use JUnit Vintage to run JUnit 4 tests. "
+ "See https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/2586 for more information.");
}
try {
PropertiesWrapper wrapper = createSurefireProperties(provider, scanResult);
storeProperties(wrapper.getProperties(), surefireProperties);
Expand Down Expand Up @@ -750,6 +755,11 @@ private EquinoxInstallation createEclipseInstallation() throws MojoExecutionExce
TestFrameworkProvider provider = selection.provider();
getLog().info(String.format("Selected test framework %s (%s) with provider %s %s", provider.getType(),
provider.getVersion(), selection.hint(), provider.getVersionRange()));
if ("junit4".equals(selection.hint())) {
getLog().warn("The JUnit 4 test framework provider is deprecated and may be removed in a future release. "
+ "Please migrate to JUnit 5 or use JUnit Vintage to run JUnit 4 tests. "
+ "See https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/2586 for more information.");
}
Collection<IRequirement> testRequiredPackages = new ArrayList<>();
Set<Artifact> testFrameworkBundles = providerHelper.filterTestFrameworkBundles(provider, pluginArtifacts);
for (Artifact artifact : testFrameworkBundles) {
Expand Down
Loading