mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
59 lines
1.9 KiB
Java
59 lines
1.9 KiB
Java
/*
|
|
* Copyright 2000-2016 JetBrains s.r.o.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
package com.intellij.junit5;
|
|
|
|
import com.intellij.testIntegration.BaseGenerateTestSupportMethodAction;
|
|
import com.intellij.testIntegration.TestIntegrationUtils;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
public class JUnit5GenerationTest extends JUnit5CodeInsightTest {
|
|
@Test
|
|
void testMethodInTopLevelClass() {
|
|
doTest("import org.junit.jupiter.api.Test; class MyTest {<caret> @Test void m2(){}}",
|
|
"""
|
|
import org.junit.jupiter.api.Test; class MyTest {
|
|
@Test
|
|
void name() {
|
|
\s
|
|
}
|
|
|
|
@Test void m2(){}}""");
|
|
}
|
|
|
|
@Test
|
|
void testMethodInNestedClass() {
|
|
doTest("import org.junit.jupiter.api.Nested; class MyTest { @Nested class NTest { <caret>}}",
|
|
"""
|
|
import org.junit.jupiter.api.Nested;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
class MyTest { @Nested class NTest {
|
|
@Test
|
|
void name() {
|
|
\s
|
|
}
|
|
}}""");
|
|
}
|
|
|
|
private void doTest(String text, String expected) {
|
|
myFixture.configureByText("MyTest.java", text);
|
|
|
|
new BaseGenerateTestSupportMethodAction.MyHandler(TestIntegrationUtils.MethodKind.TEST)
|
|
.invoke(myFixture.getProject(), myFixture.getEditor(), myFixture.getFile());
|
|
myFixture.checkResult(expected);
|
|
}
|
|
}
|