1010
1111package org .junit .jupiter .engine .descriptor ;
1212
13- import static org .apiguardian .api .API .Status .INTERNAL ;
14-
1513import java .net .URI ;
1614
17- import org .apiguardian .api .API ;
18- import org .junit .platform .commons .PreconditionViolationException ;
1915import org .junit .platform .commons .util .Preconditions ;
2016import org .junit .platform .commons .util .ReflectionUtils ;
2117import org .junit .platform .engine .discovery .DiscoverySelectors ;
2925 * @see MethodSource
3026 * @see MethodSelector
3127 */
32- @ API (status = INTERNAL , since = "5.5" )
3328class MethodSourceSupport {
3429
3530 static final String METHOD_SCHEME = "method" ;
3631
3732 /**
3833 * Create a new {@code MethodSource} from the supplied {@link URI}.
3934 *
40- * <p>The supplied {@link URI} should be of the form {@code method:<FQMN>} where FQMN is the fully qualified method name
41- * see {@link DiscoverySelectors#selectMethod(String)} for the supported formats.
35+ * <p>The supplied {@link URI} should be of the form {@code method:<FQMN>}
36+ * where FQMN is the fully qualified method name. See
37+ * {@link DiscoverySelectors#selectMethod(String)} for the supported formats.
4238 *
43- * <p></p>The {@link URI#getSchemeSpecificPart() schemeSpecificPart} component of the {@code URI}
44- * will be used as fully qualified class name. The {@linkplain URI#getFragment() fragment} component of the {@code URI}
39+ * <p></p>The {@link URI#getSchemeSpecificPart() scheme-specific part}
40+ * component of the {@code URI} will be used as fully qualified class name.
41+ * The {@linkplain URI#getFragment() fragment} component of the {@code URI}
4542 * will be used to retrieve the method name and method parameter types.
4643 *
4744 * @param uri the {@code URI} for the method; never {@code null}
4845 * @return a new {@code MethodSource}; never {@code null}
49- * @throws PreconditionViolationException if the supplied {@code URI} is
50- * {@code null} or if the scheme of the supplied {@code URI} is not equal to the {@link #METHOD_SCHEME}
51- * or if {@code URI#getSchemeSpecificPart()} is {@code null} or if {@code URI#getFragment()} is {@code null}
5246 * @since 5.5
5347 * @see #METHOD_SCHEME
5448 * @see DiscoverySelectors#selectMethod(String)
@@ -57,12 +51,14 @@ static MethodSource from(URI uri) {
5751 Preconditions .notNull (uri , "URI must not be null" );
5852 Preconditions .condition (METHOD_SCHEME .equals (uri .getScheme ()),
5953 () -> "URI [" + uri + "] must have [" + METHOD_SCHEME + "] scheme" );
60- String schemeSpecificPart = uri .getSchemeSpecificPart ();
61- Preconditions .notNull (schemeSpecificPart ,
62- "Invalid method URI. Consult the Javadoc for org.junit.platform.engine.discovery.DiscoverySelectors.selectMethod(String) for details on the supported formats." );
63- String fragment = uri .getFragment ();
64- Preconditions .notNull (fragment ,
65- "Invalid method URI. Consult the Javadoc for org.junit.platform.engine.discovery.DiscoverySelectors.selectMethod(String) for details on the supported formats." );
54+ String schemeSpecificPart = Preconditions .notNull (uri .getSchemeSpecificPart (),
55+ () -> "Invalid method URI (scheme-specific part must not be null). Please consult the Javadoc of "
56+ + DiscoverySelectors .class .getName ()
57+ + "#selectMethod(String) for details on the supported formats." );
58+ String fragment = Preconditions .notNull (uri .getFragment (),
59+ () -> "Invalid method URI (fragment must not be null). Please consult the Javadoc of "
60+ + DiscoverySelectors .class .getName ()
61+ + "#selectMethod(String) for details on the supported formats." );
6662
6763 String fullyQualifiedMethodName = schemeSpecificPart + "#" + fragment ;
6864 String [] methodSpec = ReflectionUtils .parseFullyQualifiedMethodName (fullyQualifiedMethodName );
0 commit comments