mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
accept secondary setup methods (IDEA-150310)
This commit is contained in:
@@ -55,8 +55,8 @@ public class JUnitUtil {
|
||||
public static final String BEFORE_ANNOTATION_NAME = "org.junit.Before";
|
||||
public static final String AFTER_ANNOTATION_NAME = "org.junit.After";
|
||||
public static final String PARAMETRIZED_PARAMETERS_ANNOTATION_NAME = "org.junit.runners.Parameterized.Parameters";
|
||||
private static final String AFTER_CLASS_ANNOTATION_NAME = "org.junit.AfterClass";
|
||||
private static final String BEFORE_CLASS_ANNOTATION_NAME = "org.junit.BeforeClass";
|
||||
public static final String AFTER_CLASS_ANNOTATION_NAME = "org.junit.AfterClass";
|
||||
public static final String BEFORE_CLASS_ANNOTATION_NAME = "org.junit.BeforeClass";
|
||||
private static final Collection<String> CONFIGURATIONS_ANNOTATION_NAME = Collections.unmodifiableList(
|
||||
Arrays.asList(DATA_POINT, AFTER_ANNOTATION_NAME, BEFORE_ANNOTATION_NAME, AFTER_CLASS_ANNOTATION_NAME, BEFORE_CLASS_ANNOTATION_NAME));
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@ public class JUnit4Framework extends JavaTestFramework {
|
||||
method = createSetUpPatternMethod(factory);
|
||||
PsiMethod existingMethod = clazz.findMethodBySignature(method, false);
|
||||
if (existingMethod != null) {
|
||||
if (AnnotationUtil.isAnnotated(existingMethod, JUnitUtil.BEFORE_CLASS_ANNOTATION_NAME, false)) return existingMethod;
|
||||
int exit = ApplicationManager.getApplication().isUnitTestMode() ?
|
||||
Messages.OK :
|
||||
Messages.showOkCancelDialog("Method setUp already exist but is not annotated as @Before. Annotate?",
|
||||
|
||||
@@ -36,8 +36,16 @@ import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class TestNGFramework extends JavaTestFramework {
|
||||
private final static List<String> SECONDARY_BEFORE_ANNOTATIONS = Arrays.asList("org.testng.annotations.BeforeTest",
|
||||
"org.testng.annotations.BeforeClass",
|
||||
"org.testng.annotations.BeforeSuite",
|
||||
"org.testng.annotations.BeforeGroups"
|
||||
);
|
||||
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return "TestNG";
|
||||
@@ -97,6 +105,9 @@ public class TestNGFramework extends JavaTestFramework {
|
||||
PsiMethod patternMethod = createSetUpPatternMethod(factory);
|
||||
PsiMethod inClass = clazz.findMethodBySignature(patternMethod, false);
|
||||
if (inClass != null) {
|
||||
if (AnnotationUtil.isAnnotated(inClass, SECONDARY_BEFORE_ANNOTATIONS, false)) {
|
||||
return inClass;
|
||||
}
|
||||
int exit = ApplicationManager.getApplication().isUnitTestMode() ?
|
||||
Messages.YES :
|
||||
Messages.showYesNoDialog(manager.getProject(), "Method \'" + setUpName + "\' already exist but is not annotated as @BeforeMethod.",
|
||||
|
||||
Reference in New Issue
Block a user