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.
2626[[release-notes-5.13.4-junit-platform-bug-fixes]]
2727==== Bug Fixes
2828
29- * ❓
29+ * `ClasspathResourceSelector` no longer allows to be constructed with a resource name that
30+ is blank after removing the leading slash.
3031
3132[[release-notes-5.13.4-junit-platform-deprecations-and-breaking-changes]]
3233==== Deprecations and Breaking Changes
Original file line number Diff line number Diff line change 2525import org .junit .platform .commons .PreconditionViolationException ;
2626import org .junit .platform .commons .function .Try ;
2727import org .junit .platform .commons .support .Resource ;
28+ import org .junit .platform .commons .util .Preconditions ;
2829import org .junit .platform .commons .util .ReflectionUtils ;
2930import org .junit .platform .commons .util .StringUtils ;
3031import org .junit .platform .commons .util .ToStringBuilder ;
@@ -64,6 +65,8 @@ public final class ClasspathResourceSelector implements DiscoverySelector {
6465 ClasspathResourceSelector (String classpathResourceName , @ Nullable FilePosition position ) {
6566 boolean startsWithSlash = classpathResourceName .startsWith ("/" );
6667 this .classpathResourceName = (startsWithSlash ? classpathResourceName .substring (1 ) : classpathResourceName );
68+ Preconditions .notBlank (this .classpathResourceName ,
69+ "classpath resource name must not be blank after removing leading slash" );
6770 this .position = position ;
6871 }
6972
Original file line number Diff line number Diff line change @@ -299,8 +299,11 @@ void parseDirectorySelectorWithAbsolutePath() {
299299 void selectClasspathResourcesPreconditions () {
300300 assertViolatesPrecondition (() -> selectClasspathResource ((String ) null ));
301301 assertViolatesPrecondition (() -> selectClasspathResource ("" ));
302+ assertViolatesPrecondition (() -> selectClasspathResource ("/" ));
302303 assertViolatesPrecondition (() -> selectClasspathResource (" " ));
304+ assertViolatesPrecondition (() -> selectClasspathResource ("/ " ));
303305 assertViolatesPrecondition (() -> selectClasspathResource ("\t " ));
306+ assertViolatesPrecondition (() -> selectClasspathResource ("/\t " ));
304307 assertViolatesPrecondition (() -> selectClasspathResource ((Set <Resource >) null ));
305308 assertViolatesPrecondition (() -> selectClasspathResource (Collections .emptySet ()));
306309 assertViolatesPrecondition (() -> selectClasspathResource (Collections .singleton (null )));
You can’t perform that action at this time.
0 commit comments