Top Description Constructors Methods
org.junit.platform.commons.support

public final Class ClassSupport

extends Object
Class Inheritance
Annotations
@API
status:MAINTAINED
since:1.1
Static Imports
org.apiguardian.api.API.Status.MAINTAINED

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
AnnotationSupport, ModifierSupport, ReflectionSupport

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

a comma-separated list of fully qualified class names, or an empty string if the supplied class array is null or empty
nullSafeToString
(Class<?>...
the classes whose names should be included in the generated string
classes
)

Generate a comma-separated list of fully qualified class names for the supplied classes.

public static String

Returns:

a comma-separated list of mapped values, or an empty string if the supplied class array is null or empty
nullSafeToString
(Function<? super Class<?>, ? extends String>
the mapper to use; never null
mapper
,
Class<?>...
the classes to map
classes
)

Generate a comma-separated list of mapped values for the supplied classes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ClassSupportback to summary
private ClassSupport()

Method Detail

nullSafeToStringback to summary
public static String nullSafeToString(Class<?>... classes)

Generate a comma-separated list of fully qualified class names for the supplied classes.

Parameters
classes:Class<?>[]

the classes whose names should be included in the generated string

Returns:String

a comma-separated list of fully qualified class names, or an empty string if the supplied class array is null or empty

See Also
nullSafeToString(Function, Class...)
nullSafeToStringback to summary
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 is null in which case it will be mapped to "null".

Parameters
mapper:Function<? super Class<?>, ? extends String>

the mapper to use; never null

classes:Class<?>[]

the classes to map

Returns:String

a comma-separated list of mapped values, or an empty string if the supplied class array is null or empty

See Also
nullSafeToString(Class...)