-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Draft API for reporting discovery issues #4380
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
Changes from all commits
f0807a1
a5b4ff5
0dae85d
232466a
97aba67
d79419a
57d5170
dfaa88a
7c8d2ba
8b76090
f3946a9
e414c39
cee6064
a89235c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2015-2025 the original author or authors. | ||
* | ||
* All rights reserved. This program and the accompanying materials are | ||
* made available under the terms of the Eclipse Public License v2.0 which | ||
* accompanies this distribution and is available at | ||
* | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
*/ | ||
|
||
package org.junit.jupiter.engine.descriptor; | ||
|
||
import static java.util.function.UnaryOperator.identity; | ||
import static org.apiguardian.api.API.Status.INTERNAL; | ||
|
||
import java.util.function.UnaryOperator; | ||
|
||
import org.apiguardian.api.API; | ||
import org.junit.platform.engine.DiscoveryIssue; | ||
import org.junit.platform.engine.DiscoveryIssue.Severity; | ||
|
||
/** | ||
* @since 5.13 | ||
*/ | ||
@API(status = INTERNAL, since = "5.13") | ||
public interface Validatable { | ||
|
||
void validate(IssueReporter issueReporter); | ||
|
||
interface IssueReporter { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚲🏠 Why did you choose |
||
|
||
default void reportIssue(Severity severity, String message) { | ||
reportIssue(severity, message, identity()); | ||
} | ||
|
||
void reportIssue(Severity severity, String message, UnaryOperator<DiscoveryIssue.Builder> issueBuilder); | ||
|
||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,8 +40,9 @@ public class DiscoverySelectorResolver { | |
.addClassContainerSelectorResolver(new IsTestClassWithTests()) // | ||
.addSelectorResolver(ctx -> new ClassSelectorResolver(ctx.getClassNameFilter(), getConfiguration(ctx))) // | ||
.addSelectorResolver(ctx -> new MethodSelectorResolver(getConfiguration(ctx))) // | ||
.addTestDescriptorVisitor(ctx -> new ClassOrderingVisitor(getConfiguration(ctx))) // | ||
.addTestDescriptorVisitor(ctx -> new MethodOrderingVisitor(getConfiguration(ctx))) // | ||
.addTestDescriptorVisitor(ctx -> new ClassOrderingVisitor(ctx.getIssueReporter(), getConfiguration(ctx))) // | ||
.addTestDescriptorVisitor(ctx -> new MethodOrderingVisitor(ctx.getIssueReporter(), getConfiguration(ctx))) // | ||
.addTestDescriptorVisitor(ctx -> new ValidatingVisitor(ctx.getIssueReporter())) // | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💬 Visitors registered via |
||
.addTestDescriptorVisitor(ctx -> descriptor -> { | ||
if (descriptor instanceof JupiterTestDescriptor) { | ||
((JupiterTestDescriptor) descriptor).prunePriorToFiltering(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💬 Example of a engine-specific "post-discovery" validation that reports private lifecycle methods as deprecated (also would need to be done for
@BeforeEach
etc.).