@Override public String toString() { return new ToStringBuilder(this) // .append("displayName", displayName) // .append("testSourceUri", testSourceUri) // .toString(); }
DefaultParameterContext(Parameter parameter, int index, Optional<Object> target) { Preconditions.condition(index >= 0, "index must be greater than or equal to zero"); this.parameter = Preconditions.notNull(parameter, "parameter must not be null"); this.index = index; this.target = Preconditions.notNull(target, "target must not be null"); }
private DynamicContainer(String displayName, URI testSourceUri, Stream<? extends DynamicNode> children) { super(displayName, testSourceUri); Preconditions.notNull(children, "children must not be null"); this.children = children; }
static TestInstance.Lifecycle getTestInstanceLifecycle(Class<?> testClass, JupiterConfiguration configuration) { Preconditions.notNull(testClass, "testClass must not be null"); Preconditions.notNull(configuration, "configuration must not be null"); // @formatter:off return AnnotationUtils.findAnnotation(testClass, TestInstance.class) .map(TestInstance::value) .orElseGet(configuration::getDefaultTestInstanceLifecycle); // @formatter:on }
private Method getMethodByFullyQualifiedName(String fullyQualifiedMethodName) { String[] methodParts = ReflectionUtils.parseFullyQualifiedMethodName(fullyQualifiedMethodName); String className = methodParts[0]; String methodName = methodParts[1]; String methodParameters = methodParts[2]; Preconditions.condition(StringUtils.isBlank(methodParameters), () -> format("factory method [%s] must not declare formal parameters", fullyQualifiedMethodName)); return getMethod(loadRequiredClass(className), methodName); }
@Override public boolean isAnnotated(Class<? extends Annotation> annotationType) { Preconditions.notNull(annotationType, "annotationType must not be null"); return AnnotationUtils.isAnnotated(getMethod(), annotationType); }
@Override public boolean test(Method candidate) { // Please do not collapse the following into a single statement. if (isStatic(candidate)) { return false; } if (isPrivate(candidate)) { return false; } if (isAbstract(candidate)) { return false; } if (returnsVoid(candidate) != this.mustReturnVoid) { return false; } return isAnnotated(candidate, this.annotationType); }
/** * 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()) + ')'; }
@Override public <A extends Annotation> List<A> findRepeatableAnnotations(Class<A> annotationType) { Preconditions.notNull(annotationType, "annotationType must not be null"); return AnnotationUtils.findRepeatableAnnotations(getMethod(), annotationType); }
static String buildPrefix(String message) { return (StringUtils.isNotBlank(message) ? message + " ==> " : ""); }
DynamicNode(String displayName, URI testSourceUri) { this.displayName = Preconditions.notBlank(displayName, "displayName must not be null or blank"); this.testSourceUri = testSourceUri; }
@Override public boolean test(Class<?> candidate) { // Do not collapse into a single return statement. if (isPrivate(candidate)) { return false; } if (!isInnerClass(candidate)) { return false; } return true; }
private boolean hasTestOrTestFactoryOrTestTemplateMethods(Class<?> candidate) { return ReflectionUtils.isMethodPresent(candidate, isTestOrTestFactoryOrTestTemplateMethod); }
@Override public <A extends Annotation> Optional<A> findAnnotation(Class<A> annotationType) { Preconditions.notNull(annotationType, "annotationType must not be null"); return AnnotationUtils.findAnnotation(getMethod(), annotationType); }
@Override public String toString() { // @formatter:off return new ToStringBuilder(this) .append("parameter", this.parameter) .append("index", this.index) .append("target", this.target) .toString(); // @formatter:on }
private DynamicTest(String displayName, URI testSourceUri, Executable executable) { super(displayName, testSourceUri); this.executable = Preconditions.notNull(executable, "executable must not be null"); }
private static String buildSuffix(String message) { return StringUtils.isNotBlank(message) ? ": " + message : ""; }
@Override public String toString() { // @formatter:off return new ToStringBuilder(this) .append("testClass", this.testClass) .append("outerInstance", this.outerInstance) .toString(); // @formatter:on }
public DefaultJupiterConfiguration(ConfigurationParameters configurationParameters) { this.configurationParameters = Preconditions.notNull(configurationParameters, "ConfigurationParameters must not be null"); }
@Override public String toString() { // @formatter:off return new ToStringBuilder(this) .append("currentRepetition", this.currentRepetition) .append("totalRepetitions", this.totalRepetitions) .toString(); // @formatter:on }