MethodBasedTestDescriptor(UniqueId uniqueId, String displayName, Class<?> testClass, Method testMethod, JupiterConfiguration configuration) { super(uniqueId, displayName, MethodSource.from(testClass, testMethod), configuration); this.testClass = Preconditions.notNull(testClass, "Class must not be null"); this.testMethod = testMethod; this.tags = getTags(testMethod); }
private static MethodSource toMethodSource(Class<?> testClass, String methodName) { if (methodName.contains("[") && methodName.endsWith("]")) { // special case for parameterized tests return toMethodSource(testClass, methodName.substring(0, methodName.indexOf("["))); } else { List<Method> methods = findMethods(testClass, where(Method::getName, isEqual(methodName))); return (methods.size() == 1) ? MethodSource.from(testClass, getOnlyElement(methods)) : null; } }
public BenchmarkMethodDescriptor(UniqueId uniqueId, BenchmarkMethod method) { super(uniqueId, generateDefaultDisplayName(method), MethodSource.from(method.getDeclaringClass(), method.getMethod())); this.method = method; }
private ParametrizedBenchmarkMethodDescriptor(UniqueId uniqueId, BenchmarkMethod benchmarkMethod, ParametrizedBenchmarkMethod parametrizedMethod) { super(uniqueId, generateDefaultDisplayName(benchmarkMethod.getMethod()), MethodSource.from(benchmarkMethod.getDeclaringClass(), benchmarkMethod.getMethod())); this.method = benchmarkMethod; this.parametrizedMethod = parametrizedMethod; }
public BenchmarkFixtureDescriptor(UniqueId uniqueId, BenchmarkMethod method, BenchmarkFixture fixture) { super(uniqueId, fixture.getDisplayName(), MethodSource.from(method.getMethod())); this.fixture = fixture; this.tags = DescriptorUtils.getTags(method.getDeclaringClass()); }