junit 5: rerun failed by method with signature

This commit is contained in:
Anna.Kozlova
2017-04-19 14:01:07 +02:00
parent 16b0cce4f6
commit 846efc4e70
2 changed files with 14 additions and 2 deletions
@@ -89,9 +89,9 @@ public class TestMethods extends TestMethod {
: ((PsiMethod)element).getContainingClass();
if (containingClass != null) {
final String proxyName = testInfo.getName();
final String methodName = ((PsiMethod)element).getName();
final String methodWithSignaturePresentation = JUnitConfiguration.Data.getMethodPresentation(((PsiMethod)element));
return JavaExecutionUtil.getRuntimeQualifiedName(containingClass) + "," +
(proxyName.contains(methodName) ? proxyName.substring(proxyName.indexOf(methodName)) : methodName);
(proxyName.contains(methodWithSignaturePresentation) ? proxyName.substring(proxyName.indexOf(methodWithSignaturePresentation)) : methodWithSignaturePresentation);
}
}
return null;
@@ -174,6 +174,18 @@ public class JUnitRerunFailedTestsTest extends LightCodeInsightFixtureTestCase
assertEquals(aClass, element);
}
public void testPresentationForJunit5MethodsWithParameters() throws Exception {
myFixture.addClass("class A {}" +
"public class TestClass {\n" +
" @org.junit.platform.commons.annotation.Testable" +
" public void testFoo(A a) throws Exception {}\n" +
"}");
final SMTestProxy testProxy = new SMTestProxy("testFoo", false, "java:test://TestClass.testFoo");
testProxy.setLocator(JavaTestLocator.INSTANCE);
final String presentation = TestMethods.getTestPresentation(testProxy, myFixture.getProject(), GlobalSearchScope.projectScope(myFixture.getProject()));
assertEquals("TestClass,testFoo(A)", presentation);
}
public void testMultipleClassesInOneFile() throws Exception {
myFixture.configureByText("a.java", "public class Test1 {<caret>} public class Test2 {}");