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 2424import org .junit .platform .commons .PreconditionViolationException ;
2525import org .junit .platform .commons .function .Try ;
2626import org .junit .platform .commons .support .Resource ;
27+ import org .junit .platform .commons .util .Preconditions ;
2728import org .junit .platform .commons .util .ReflectionUtils ;
2829import org .junit .platform .commons .util .StringUtils ;
2930import org .junit .platform .commons .util .ToStringBuilder ;
@@ -61,6 +62,8 @@ public class ClasspathResourceSelector implements DiscoverySelector {
6162 ClasspathResourceSelector (String classpathResourceName , FilePosition position ) {
6263 boolean startsWithSlash = classpathResourceName .startsWith ("/" );
6364 this .classpathResourceName = (startsWithSlash ? classpathResourceName .substring (1 ) : classpathResourceName );
65+ Preconditions .notBlank (this .classpathResourceName ,
66+ "classpath resource name must not be blank after removing leading slash" );
6467 this .position = position ;
6568 }
6669
Original file line number Diff line number Diff line change @@ -292,8 +292,11 @@ void parseDirectorySelectorWithAbsolutePath() {
292292 void selectClasspathResourcesPreconditions () {
293293 assertViolatesPrecondition (() -> selectClasspathResource ((String ) null ));
294294 assertViolatesPrecondition (() -> selectClasspathResource ("" ));
295+ assertViolatesPrecondition (() -> selectClasspathResource ("/" ));
295296 assertViolatesPrecondition (() -> selectClasspathResource (" " ));
297+ assertViolatesPrecondition (() -> selectClasspathResource ("/ " ));
296298 assertViolatesPrecondition (() -> selectClasspathResource ("\t " ));
299+ assertViolatesPrecondition (() -> selectClasspathResource ("/\t " ));
297300 assertViolatesPrecondition (() -> selectClasspathResource ((Set <Resource >) null ));
298301 assertViolatesPrecondition (() -> selectClasspathResource (Collections .emptySet ()));
299302 assertViolatesPrecondition (() -> selectClasspathResource (Collections .singleton (null )));
You can’t perform that action at this time.
0 commit comments