Class ClassSupport
java.lang.Object
org.junit.platform.commons.support.ClassSupport
ClassSupport provides static utility methods for common tasks
regarding classes — for example, generating a
comma-separated list of fully qualified class names for a set of supplied
classes.
TestEngine and extension
authors are encouraged to use these supported methods in order to align with
the behavior of the JUnit Platform.
- Since:
- 1.1
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringnullSafeToString(Class<?>... classes) Generate a comma-separated list of fully qualified class names for the supplied classes.static StringnullSafeToString(Function<? super Class<?>, ? extends String> mapper, Class<?>... classes) Generate a comma-separated list of mapped values for the supplied classes.
-
Method Details
-
nullSafeToString
Generate a comma-separated list of fully qualified class names for the supplied classes.- Parameters:
classes- the classes whose names should be included in the generated string- Returns:
- a comma-separated list of fully qualified class names, or an empty
string if the supplied class array is
nullor empty - See Also:
-
nullSafeToString
public static String nullSafeToString(Function<? super Class<?>, ? extends String> mapper, Class<?>... classes) Generate a comma-separated list of mapped values for the supplied classes.The values are generated by the supplied
mapper(e.g.,Class::getName,Class::getSimpleName, etc.), unless a class reference isnullin which case it will be mapped to"null".- Parameters:
mapper- the mapper to use; nevernullclasses- the classes to map- Returns:
- a comma-separated list of mapped values, or an empty string if
the supplied class array is
nullor empty - See Also:
-