File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed
documentation/src/docs/asciidoc/release-notes
junit-platform-engine/src/main/java/org/junit/platform/engine/discovery
platform-tests/src/test/java/org/junit/platform/engine/discovery Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,8 @@ repository on GitHub.
26
26
[[release-notes-5.13.4-junit-platform-bug-fixes]]
27
27
==== Bug Fixes
28
28
29
- * ❓
29
+ * `ClasspathResourceSelector` no longer allows to be constructed with a resource name that
30
+ is blank after removing the leading slash.
30
31
31
32
[[release-notes-5.13.4-junit-platform-deprecations-and-breaking-changes]]
32
33
==== Deprecations and Breaking Changes
Original file line number Diff line number Diff line change 25
25
import org .junit .platform .commons .PreconditionViolationException ;
26
26
import org .junit .platform .commons .function .Try ;
27
27
import org .junit .platform .commons .support .Resource ;
28
+ import org .junit .platform .commons .util .Preconditions ;
28
29
import org .junit .platform .commons .util .ReflectionUtils ;
29
30
import org .junit .platform .commons .util .StringUtils ;
30
31
import org .junit .platform .commons .util .ToStringBuilder ;
@@ -64,6 +65,8 @@ public final class ClasspathResourceSelector implements DiscoverySelector {
64
65
ClasspathResourceSelector (String classpathResourceName , @ Nullable FilePosition position ) {
65
66
boolean startsWithSlash = classpathResourceName .startsWith ("/" );
66
67
this .classpathResourceName = (startsWithSlash ? classpathResourceName .substring (1 ) : classpathResourceName );
68
+ Preconditions .notBlank (this .classpathResourceName ,
69
+ "classpath resource name must not be blank after removing leading slash" );
67
70
this .position = position ;
68
71
}
69
72
Original file line number Diff line number Diff line change @@ -299,8 +299,11 @@ void parseDirectorySelectorWithAbsolutePath() {
299
299
void selectClasspathResourcesPreconditions () {
300
300
assertViolatesPrecondition (() -> selectClasspathResource ((String ) null ));
301
301
assertViolatesPrecondition (() -> selectClasspathResource ("" ));
302
+ assertViolatesPrecondition (() -> selectClasspathResource ("/" ));
302
303
assertViolatesPrecondition (() -> selectClasspathResource (" " ));
304
+ assertViolatesPrecondition (() -> selectClasspathResource ("/ " ));
303
305
assertViolatesPrecondition (() -> selectClasspathResource ("\t " ));
306
+ assertViolatesPrecondition (() -> selectClasspathResource ("/\t " ));
304
307
assertViolatesPrecondition (() -> selectClasspathResource ((Set <Resource >) null ));
305
308
assertViolatesPrecondition (() -> selectClasspathResource (Collections .emptySet ()));
306
309
assertViolatesPrecondition (() -> selectClasspathResource (Collections .singleton (null )));
You can’t perform that action at this time.
0 commit comments