mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
junit 5: fix parameter presentation (IDEA-173408)
This commit is contained in:
@@ -647,12 +647,17 @@ public class JUnitConfiguration extends JavaTestConfigurationBase {
|
||||
if (aClass == null) {
|
||||
return "";
|
||||
}
|
||||
return "L" + ClassUtil.getJVMClassName(aClass) + ";";
|
||||
return ClassUtil.getJVMClassName(aClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String visitArrayType(PsiArrayType arrayType) {
|
||||
return "[" + arrayType.getComponentType().accept(this);
|
||||
PsiType componentType = arrayType.getComponentType();
|
||||
String typePresentation = componentType.accept(this);
|
||||
if (componentType instanceof PsiClassType) {
|
||||
typePresentation = "L" + typePresentation + ";";
|
||||
}
|
||||
return "[" + typePresentation;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -29,15 +29,23 @@ public class JUnit5NamingTest extends JUnit5CodeInsightTest {
|
||||
PsiJavaFile file = (PsiJavaFile)myFixture.configureByText("MyTest.java", "import org.junit.jupiter.api.*;" +
|
||||
"class MyTest {" +
|
||||
" @Test void foo(int[] i); \n" +
|
||||
" @Test void foo(int i); \n" +
|
||||
" @Test void foo(String[] i); \n" +
|
||||
" @Test void foo(String i); \n" +
|
||||
" @Test void foo(Foo[] i); \n" +
|
||||
" @Test void foo(Foo i); \n" +
|
||||
" static class Foo {}" +
|
||||
"}");
|
||||
String[] methodPresentations =
|
||||
Arrays.stream(file.getClasses()[0].getMethods())
|
||||
.map(method -> JUnitConfiguration.Data.getMethodPresentation(method))
|
||||
.toArray(String[]::new);
|
||||
Assertions.assertArrayEquals(new String[] {"foo([int)", "foo([Ljava.lang.String;)", "foo([LMyTest$Foo;)"},
|
||||
Assertions.assertArrayEquals(new String[] {"foo([int)",
|
||||
"foo(int)",
|
||||
"foo([Ljava.lang.String;)",
|
||||
"foo(java.lang.String)",
|
||||
"foo([LMyTest$Foo;)",
|
||||
"foo(MyTest$Foo)"},
|
||||
methodPresentations,
|
||||
Arrays.toString(methodPresentations));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user