private static String parameterList(Method method) { return ClassUtils.nullSafeToString(method.getParameterTypes()); } }
@Override public String getLegacyReportingName() { return String.format("%s(%s)", testMethod.getName(), ClassUtils.nullSafeToString(Class::getSimpleName, testMethod.getParameterTypes())); }
/** * Compile a string representation from all simple parameter type names. * * @param method the method providing parameter types for the result; never {@code null} * @return a string representation of all parameter types of the * supplied method or {@code "()"} if the method has no parameters */ static String parameterTypesAsString(Method method) { Preconditions.notNull(method, "Method must not be null"); return '(' + ClassUtils.nullSafeToString(Class::getSimpleName, method.getParameterTypes()) + ')'; }
private UniqueId createUniqueId(Method method, TestDescriptor parent) { String methodId = String.format("%s(%s)", method.getName(), ClassUtils.nullSafeToString(method.getParameterTypes())); return parent.getUniqueId().append(this.segmentType, methodId); }
private void resolveClass(Class<?> testClass) { try { Set<TestDescriptor> resolvedDescriptors = resolveContainerWithParents(testClass); resolvedDescriptors.forEach(this::resolveChildren); if (resolvedDescriptors.isEmpty()) { logger.debug(() -> format("Class '%s' could not be resolved.", nullSafeToString(testClass))); } } catch (Throwable t) { rethrowIfBlacklisted(t); logger.debug(t, () -> format("Class '%s' could not be resolved.", nullSafeToString(testClass))); } }
@Override public <T> T get(int index, Class<T> requiredType) { Preconditions.notNull(requiredType, "requiredType must not be null"); Object value = get(index); try { Object convertedValue = DefaultArgumentConverter.INSTANCE.convert(value, requiredType); return requiredType.cast(convertedValue); } catch (Exception ex) { String message = format( "Argument at index [%d] with value [%s] and type [%s] could not be converted or cast to type [%s].", index, value, ClassUtils.nullSafeToString(value == null ? null : value.getClass()), requiredType.getName()); throw new ArgumentAccessException(message, ex); } }
private static String generateDefaultDisplayName(Method testMethod) { return String.format("%s(%s)", testMethod.getName(), ClassUtils.nullSafeToString(Class::getSimpleName, testMethod.getParameterTypes())); } }
MethodSelector(Class<?> javaClass, Method method) { this.javaClass = javaClass; this.className = javaClass.getName(); this.javaMethod = method; this.methodName = method.getName(); this.methodParameterTypes = ClassUtils.nullSafeToString(method.getParameterTypes()); }
private static String generateDefaultDisplayName(Method method) { return String.format("%s(%s)", method.getName(), ClassUtils.nullSafeToString(Class::getSimpleName, method.getParameterTypes())); } }
public static String describeMethodId(Method method) { return String.format("%s(%s)", method.getName(), ClassUtils.nullSafeToString(method.getParameterTypes())); }
/** * @since 1.3 */ private MethodSource(Class<?> testClass, Method testMethod) { Preconditions.notNull(testClass, "Class must not be null"); Preconditions.notNull(testMethod, "Method must not be null"); this.className = testClass.getName(); this.methodName = testMethod.getName(); this.methodParameterTypes = nullSafeToString(testMethod.getParameterTypes()); }
protected Object executeMethod(String methodName, Class<?>[] parameterTypes, Object... arguments) { Method method = findMethod(this.target.getClass(), methodName, parameterTypes).orElseThrow( () -> new JUnitException(String.format("Failed to find method %s(%s) in class %s", methodName, ClassUtils.nullSafeToString(parameterTypes), this.target.getClass().getName()))); return invokeMethod(method, this.target, arguments); }