private String getMethodName(TestIdentifier description) { try { TestSource testSource = description.getSource().get(); if (testSource instanceof MethodSource) { return ((MethodSource) testSource).getMethodName(); } return description.getDisplayName().split("\\(|\\)")[0]; } catch (Exception e) { return description.getDisplayName(); } }
private String getTechnicalName(TestIdentifier testIdentifier) { Optional<TestSource> optionalSource = testIdentifier.getSource(); if (optionalSource.isPresent()) { TestSource source = optionalSource.get(); if (source instanceof ClassSource) { return ((ClassSource) source).getJavaClass().getName(); } else if (source instanceof MethodSource) { MethodSource methodSource = (MethodSource) source; String methodParameterTypes = methodSource.getMethodParameterTypes(); if (StringUtils.isBlank(methodParameterTypes)) { return methodSource.getMethodName(); } return String.format("%s(%s)", methodSource.getMethodName(), methodParameterTypes); } } // Else fall back to display name return testIdentifier.getDisplayName(); }
.orElse( new String[] { realClassName, realClassName } ); String methodName = methodSource.getMethodName(); boolean useMethod = display.equals( methodName ) || display.equals( methodName + "()" ); String resolvedMethodName = useMethod ? methodName : display;
private boolean shouldRun( MethodSource source ) { String testClass = TestListResolver.toClassFileName( source.getClassName() ); String testMethod = source.getMethodName(); return this.testListResolver.shouldRun( testClass, testMethod ); } }