GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Improve message of discovery issues for ineffective `@Order` annotati… · junit-team/junit-framework@8a0be13

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • documentation/src/docs/asciidoc/release-notes
    • release-notes-5.13.3.adoc
  • junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery
    • ClassOrderingVisitor.java
    • MethodOrderingVisitor.java
  • jupiter-tests/src/test/java/org/junit/jupiter/engine/extension
    • OrderedClassTests.java
    • OrderedMethodTests.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎documentation/src/docs/asciidoc/release-notes/release-notes-5.13.3.adoc‎

Copy file name to clipboardExpand all lines: documentation/src/docs/asciidoc/release-notes/release-notes-5.13.3.adoc
+1Lines changed: 1 addition & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ repository on GitHub.
5959
that both `null` and _blank_ values are supported for reason strings and that such
6060
values will result in an _empty_ `Optional` returned from
6161
`ConditionEvaluationResult.getReason()`.
62+
* Improve message of discovery issues reported for ineffective `@Order` annotations.
6263

6364

6465
[[release-notes-5.13.3-junit-vintage]]
Collapse file

‎junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassOrderingVisitor.java‎

Copy file name to clipboardExpand all lines: junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassOrderingVisitor.java
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.junit.platform.engine.DiscoveryIssue;
2929
import org.junit.platform.engine.DiscoveryIssue.Severity;
3030
import org.junit.platform.engine.TestDescriptor;
31-
import org.junit.platform.engine.support.descriptor.ClassSource;
3231
import org.junit.platform.engine.support.discovery.DiscoveryIssueReporter;
3332
import org.junit.platform.engine.support.discovery.DiscoveryIssueReporter.Condition;
3433

@@ -49,11 +48,12 @@ class ClassOrderingVisitor extends AbstractOrderingVisitor {
4948
this.globalOrderer = createGlobalOrderer(configuration);
5049
this.noOrderAnnotation = issueReporter.createReportingCondition(
5150
testDescriptor -> !isAnnotated(testDescriptor.getTestClass(), Order.class), testDescriptor -> {
52-
String message = String.format(
53-
"Ineffective @Order annotation on class '%s'. It will not be applied because ClassOrderer.OrderAnnotation is not in use.",
54-
testDescriptor.getTestClass().getName());
51+
String message = String.format("Ineffective @Order annotation on class '%s'. ",
52+
testDescriptor.getTestClass().getName())
53+
+ "It will not be applied because ClassOrderer.OrderAnnotation is not in use. "
54+
+ "Note that the annotation may be either directly present or meta-present on the class.";
5555
return DiscoveryIssue.builder(Severity.INFO, message) //
56-
.source(ClassSource.from(testDescriptor.getTestClass())) //
56+
.source(testDescriptor.getSource()) //
5757
.build();
5858
});
5959
}
Collapse file

‎junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodOrderingVisitor.java‎

Copy file name to clipboardExpand all lines: junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodOrderingVisitor.java
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import org.junit.platform.engine.DiscoveryIssue;
3232
import org.junit.platform.engine.DiscoveryIssue.Severity;
3333
import org.junit.platform.engine.TestDescriptor;
34-
import org.junit.platform.engine.support.descriptor.MethodSource;
3534
import org.junit.platform.engine.support.discovery.DiscoveryIssueReporter;
3635
import org.junit.platform.engine.support.discovery.DiscoveryIssueReporter.Condition;
3736

@@ -51,11 +50,12 @@ class MethodOrderingVisitor extends AbstractOrderingVisitor {
5150
this.configuration = configuration;
5251
this.noOrderAnnotation = issueReporter.createReportingCondition(
5352
testDescriptor -> !isAnnotated(testDescriptor.getTestMethod(), Order.class), testDescriptor -> {
54-
String message = String.format(
55-
"Ineffective @Order annotation on method '%s'. It will not be applied because MethodOrderer.OrderAnnotation is not in use.",
56-
testDescriptor.getTestMethod().toGenericString());
53+
String message = String.format("Ineffective @Order annotation on method '%s'. ",
54+
testDescriptor.getTestMethod().toGenericString())
55+
+ "It will not be applied because MethodOrderer.OrderAnnotation is not in use. "
56+
+ "Note that the annotation may be either directly present or meta-present on the method.";
5757
return DiscoveryIssue.builder(Severity.INFO, message) //
58-
.source(MethodSource.from(testDescriptor.getTestMethod())) //
58+
.source(testDescriptor.getSource()) //
5959
.build();
6060
});
6161
this.methodsBeforeNestedClassesOrderer = createMethodsBeforeNestedClassesOrderer();
Collapse file

‎jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedClassTests.java‎

Copy file name to clipboardExpand all lines: jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedClassTests.java
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ private static void assertIneffectiveOrderAnnotationIssues(List<DiscoveryIssue>
204204
assertThat(discoveryIssues).extracting(DiscoveryIssue::severity).containsOnly(Severity.INFO);
205205
assertThat(discoveryIssues).extracting(DiscoveryIssue::message) //
206206
.allMatch(it -> it.startsWith("Ineffective @Order annotation on class")
207-
&& it.endsWith("It will not be applied because ClassOrderer.OrderAnnotation is not in use."));
207+
&& it.contains("It will not be applied because ClassOrderer.OrderAnnotation is not in use.")
208+
&& it.endsWith(
209+
"Note that the annotation may be either directly present or meta-present on the class."));
208210
assertThat(discoveryIssues).extracting(DiscoveryIssue::source).extracting(Optional::orElseThrow) //
209211
.containsExactlyInAnyOrder(ClassSource.from(A_TestCase.class), ClassSource.from(C_TestCase.class));
210212
}
Collapse file

‎jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedMethodTests.java‎

Copy file name to clipboardExpand all lines: jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedMethodTests.java
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,9 @@ private static void assertIneffectiveOrderAnnotationIssues(List<DiscoveryIssue>
394394
assertThat(discoveryIssues).extracting(DiscoveryIssue::severity).containsOnly(Severity.INFO);
395395
assertThat(discoveryIssues).extracting(DiscoveryIssue::message) //
396396
.allMatch(it -> it.startsWith("Ineffective @Order annotation on method")
397-
&& it.endsWith("It will not be applied because MethodOrderer.OrderAnnotation is not in use."));
397+
&& it.contains("It will not be applied because MethodOrderer.OrderAnnotation is not in use.")
398+
&& it.endsWith(
399+
"Note that the annotation may be either directly present or meta-present on the method."));
398400
var testClass = WithoutTestMethodOrderTestCase.class;
399401
assertThat(discoveryIssues).extracting(DiscoveryIssue::source).extracting(Optional::orElseThrow) //
400402
.containsExactlyInAnyOrder(MethodSource.from(testClass.getDeclaredMethod("test1")),

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.