import com.intellij.codeInsight.CodeInsightActionHandler;
import com.intellij.codeInsight.CodeInsightBundle;
-import com.intellij.codeInsight.intention.AddAnnotationFix;
import com.intellij.ide.util.MemberChooser;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
final Project project = method.getProject();
for (PsiAnnotation annotation : methodCandidate.getElement().getModifierList().getAnnotations()) {
- annotate(method, project, annotation.getQualifiedName());
+ OverrideImplementUtil.annotate(method, annotation.getQualifiedName());
}
final PsiClass targetClass = ((PsiMember)target).getContainingClass();
LOG.assertTrue(targetClass != null);
- final PsiMethod[] methods = targetClass.findMethodsBySignature(method, true);
- boolean insertOverride = false;
- for (PsiMethod superMethod : methods) {
- if (OverrideImplementUtil.isInsertOverride(superMethod, targetClass)) {
- insertOverride = true;
- break;
- }
- }
- if (insertOverride) {
- annotate(method, project, Override.class.getName());
+ PsiMethod overridden = targetClass.findMethodBySignature(method, true);
+ if (overridden != null) {
+ OverrideImplementUtil.annotateOnOverrideImplement(method, targetClass, overridden);
}
return new PsiGenerationInfo<PsiMethod>(method);
}
- private static void annotate(PsiMethod method, Project project, final String qualifiedName) {
- final AddAnnotationFix fix = new AddAnnotationFix(qualifiedName, method);
- if (fix.isAvailable(project, null, method.getContainingFile())) {
- fix.invoke(project, null, method.getContainingFile());
- }
- }
-
private static void clearMethod(PsiMethod method) throws IncorrectOperationException {
LOG.assertTrue(!method.isPhysical());
PsiCodeBlock codeBlock = JavaPsiFacade.getInstance(method.getProject()).getElementFactory().createCodeBlock();
if (!mySuperHasHashCode) {
@NonNls String text = "";
CodeStyleSettings styleSettings = CodeStyleSettingsManager.getSettings(myProject);
- if (styleSettings.INSERT_OVERRIDE_ANNOTATION && PsiUtil.isLanguageLevel5OrHigher(myClass)) {
+ if (GenerateMembersUtil.shouldAddOverrideAnnotation(myClass, false)) {
text += "@Override\n";
}
@NonNls StringBuffer buffer = new StringBuffer();
CodeStyleSettings styleSettings = CodeStyleSettingsManager.getSettings(myProject);
- if (styleSettings.INSERT_OVERRIDE_ANNOTATION && PsiUtil.isLanguageLevel5OrHigher(myClass)) {
+ if (GenerateMembersUtil.shouldAddOverrideAnnotation(myClass, false)) {
buffer.append("@Override\n");
}
buffer.append("public boolean equals(Object ").append(myParameterName).append(") {\n");
@NonNls StringBuilder buffer = new StringBuilder();
CodeStyleSettings styleSettings = CodeStyleSettingsManager.getSettings(myProject);
- if (styleSettings.INSERT_OVERRIDE_ANNOTATION && PsiUtil.isLanguageLevel5OrHigher(myClass)) {
+ if (GenerateMembersUtil.shouldAddOverrideAnnotation(myClass, false)) {
buffer.append("@Override\n");
}
buffer.append("public int hashCode() {\n");
*/
package com.intellij.codeInsight.generation;
+import com.intellij.codeInsight.daemon.impl.quickfix.CreateFromUsageUtils;
import com.intellij.lang.ASTNode;
import com.intellij.lang.StdLanguages;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.psi.codeStyle.VariableKind;
import com.intellij.psi.javadoc.PsiDocComment;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.util.TypeConversionUtil;
-import com.intellij.util.VisibilityUtil;
import com.intellij.util.IncorrectOperationException;
+import com.intellij.util.VisibilityUtil;
import com.intellij.util.containers.HashMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
if (child == null) return false;
}
}
+
+ public static boolean shouldAddOverrideAnnotation(PsiElement context, boolean interfaceMethod) {
+ CodeStyleSettings style = CodeStyleSettingsManager.getSettings(context.getProject());
+ if (!style.INSERT_OVERRIDE_ANNOTATION) return false;
+
+ if (interfaceMethod) return PsiUtil.isLanguageLevel6OrHigher(context);
+ return PsiUtil.isLanguageLevel5OrHigher(context);
+ }
+
+ public static void setupGeneratedMethod(PsiMethod method) {
+ PsiClass base = method.getContainingClass().getSuperClass();
+ PsiMethod overridden = base == null ? null : base.findMethodBySignature(method, true);
+
+ if (overridden == null) {
+ CreateFromUsageUtils.setupMethodBody(method, method.getContainingClass());
+ return;
+ }
+
+ OverrideImplementUtil.setupMethodBody(method, overridden, method.getContainingClass());
+ OverrideImplementUtil.annotateOnOverrideImplement(method, base, overridden);
+ }
}
}
public static boolean isInsertOverride(PsiMethod superMethod, PsiClass targetClass) {
- if (!CodeStyleSettingsManager.getSettings(targetClass.getProject()).INSERT_OVERRIDE_ANNOTATION || !PsiUtil.isLanguageLevel5OrHigher(targetClass)) {
+ if (!CodeStyleSettingsManager.getSettings(targetClass.getProject()).INSERT_OVERRIDE_ANNOTATION
+ || !PsiUtil.isLanguageLevel5OrHigher(targetClass)) {
return false;
}
if (PsiUtil.isLanguageLevel6OrHigher(targetClass)) return true;
PsiMethod method,
PsiSubstitutor substitutor,
boolean toCopyJavaDoc,
- boolean insertAtOverrideIfPossible) throws IncorrectOperationException {
+ boolean insertOverrideIfPossible) throws IncorrectOperationException {
if (!method.isValid() || !substitutor.isValid()) return Collections.emptyList();
List<PsiMethod> results = new ArrayList<PsiMethod>();
}
}
- if (insertAtOverrideIfPossible && isInsertOverride(method, aClass) && !method.isConstructor()) {
- annotate(result, "java.lang.Override");
- }
-
- for (OverrideImplementsAnnotationsHandler annotationsHandler : Extensions
- .getExtensions(OverrideImplementsAnnotationsHandler.EP_NAME)) {
- for (String annotationFQName : annotationsHandler.getAnnotations()) {
- if (AnnotationUtil.isAnnotated(method, annotationFQName, false)) {
- annotate(result, annotationFQName, annotationsHandler.annotationsToRemove(annotationFQName));
- }
- }
- }
-
+ annotateOnOverrideImplement(result, aClass, method, insertOverrideIfPossible);
+
final PsiCodeBlock body = JavaPsiFacade.getInstance(method.getProject()).getElementFactory().createCodeBlockFromText("{}", null);
PsiCodeBlock oldbody = result.getBody();
if (oldbody != null){
return results;
}
- private static void annotate(final PsiMethod result, String fqn, String... annosToRemove) throws IncorrectOperationException {
+ public static void annotateOnOverrideImplement(PsiMethod method, PsiClass targetClass, PsiMethod overridden) {
+ annotateOnOverrideImplement(method, targetClass, overridden,
+ CodeStyleSettingsManager.getSettings(method.getProject()).INSERT_OVERRIDE_ANNOTATION);
+ }
+
+ public static void annotateOnOverrideImplement(PsiMethod method, PsiClass targetClass, PsiMethod overridden, boolean insertOverride) {
+ if (insertOverride && !overridden.isConstructor() && isInsertOverride(overridden, targetClass)) {
+ annotate(method, Override.class.getName());
+ }
+ for (OverrideImplementsAnnotationsHandler each : Extensions.getExtensions(OverrideImplementsAnnotationsHandler.EP_NAME)) {
+ for (String annotation : each.getAnnotations()) {
+ if (AnnotationUtil.isAnnotated(overridden, annotation, false)) {
+ annotate(method, annotation, each.annotationsToRemove(annotation));
+ }
+ }
+ }
+ }
+
+ public static void annotate(PsiMethod result, String fqn, String... annosToRemove) throws IncorrectOperationException {
Project project = result.getProject();
AddAnnotationFix fix = new AddAnnotationFix(fqn, result, annosToRemove);
if (fix.isAvailable(project, null, result.getContainingFile())) {
}
@NotNull
- private static String callSuper (PsiMethod superMethod, PsiMethod overriding) {
+ public static String callSuper (PsiMethod superMethod, PsiMethod overriding) {
@NonNls StringBuilder buffer = new StringBuilder();
if (!superMethod.isConstructor() && superMethod.getReturnType() != PsiType.VOID) {
buffer.append("return ");
if (frameworks.size() == 1) {
doGenerate(editor, file, targetClass, frameworks.get(0));
- } else {
- final JList list = new JList(frameworks.toArray(new TestFramework[frameworks.size()]));
- list.setCellRenderer(new DefaultListCellRenderer() {
- @Override
- public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
- Component result = super.getListCellRendererComponent(list, "", index, isSelected, cellHasFocus);
- if (value == null) return result;
- TestFramework framework = (TestFramework)value;
-
- setIcon(framework.getIcon());
- setText(framework.getName());
-
- return result;
- }
- });
+ return;
+ }
- final Runnable runnable = new Runnable() {
- public void run() {
- TestFramework selected = (TestFramework)list.getSelectedValue();
- if (selected == null) return;
- doGenerate(editor, file, targetClass, selected);
- }
- };
+ final JList list = new JList(frameworks.toArray(new TestFramework[frameworks.size()]));
+ list.setCellRenderer(new DefaultListCellRenderer() {
+ @Override
+ public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+ Component result = super.getListCellRendererComponent(list, "", index, isSelected, cellHasFocus);
+ if (value == null) return result;
+ TestFramework framework = (TestFramework)value;
- PopupChooserBuilder builder = new PopupChooserBuilder(list);
- builder.setFilteringEnabled(new Function<Object, String>() {
- @Override
- public String fun(Object o) {
- return ((TestFramework)o).getName();
- }
- });
+ setIcon(framework.getIcon());
+ setText(framework.getName());
- builder
- .setTitle("Choose Framework")
- .setItemChoosenCallback(runnable)
- .setMovable(true)
- .createPopup().showInBestPositionFor(editor);
- }
+ return result;
+ }
+ });
+
+ final Runnable runnable = new Runnable() {
+ public void run() {
+ TestFramework selected = (TestFramework)list.getSelectedValue();
+ if (selected == null) return;
+ doGenerate(editor, file, targetClass, selected);
+ }
+ };
+
+ PopupChooserBuilder builder = new PopupChooserBuilder(list);
+ builder.setFilteringEnabled(new Function<Object, String>() {
+ @Override
+ public String fun(Object o) {
+ return ((TestFramework)o).getName();
+ }
+ });
+
+ builder
+ .setTitle("Choose Framework")
+ .setItemChoosenCallback(runnable)
+ .setMovable(true)
+ .createPopup().showInBestPositionFor(editor);
}
private void doGenerate(final Editor editor, final PsiFile file, final PsiClass targetClass, final TestFramework framework) {
import com.intellij.codeInsight.TestUtil;
import com.intellij.codeInsight.daemon.impl.quickfix.CreateFromUsageUtils;
+import com.intellij.codeInsight.generation.GenerateMembersUtil;
import com.intellij.codeInsight.template.Expression;
import com.intellij.codeInsight.template.Template;
import com.intellij.codeInsight.template.TemplateEditingAdapter;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
-import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.refactoring.util.classMembers.MemberInfo;
-import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.util.ArrayList;
private static final Logger LOG = Logger.getInstance("#" + TestIntegrationUtils.class.getName());
public enum MethodKind {
- SET_UP {
+ SET_UP("setUp") {
public FileTemplateDescriptor getFileTemplateDescriptor(TestFramework framework) {
return framework.getSetUpMethodFileTemplateDescriptor();
- }},
- TEAR_DOWN {
+ }
+ },
+ TEAR_DOWN("tearDown") {
public FileTemplateDescriptor getFileTemplateDescriptor(TestFramework framework) {
return framework.getTearDownMethodFileTemplateDescriptor();
- }},
- TEST {
+ }
+ },
+ TEST("test") {
public FileTemplateDescriptor getFileTemplateDescriptor(TestFramework framework) {
return framework.getTestMethodFileTemplateDescriptor();
- }};
+ }
+ };
+ private String myDefaultName;
+
+ MethodKind(String defaultName) {
+ myDefaultName = defaultName;
+ }
+
+ public String getDefaultName() {
+ return myDefaultName;
+ }
public abstract FileTemplateDescriptor getFileTemplateDescriptor(TestFramework framework);
}
return result;
}
- public static PsiMethod createMethod(PsiClass targetClass, String name, String annotation) throws IncorrectOperationException {
- PsiElementFactory f = JavaPsiFacade.getInstance(targetClass.getProject()).getElementFactory();
- PsiMethod result = f.createMethod(name, PsiType.VOID);
- result.getBody().add(f.createCommentFromText("// Add your code here", result));
-
- if (annotation != null) {
- PsiAnnotation a = f.createAnnotationFromText("@" + annotation, result);
- PsiModifierList modifiers = result.getModifierList();
- PsiElement first = modifiers.getFirstChild();
- if (first == null) {
- modifiers.add(a);
- }
- else {
- modifiers.addBefore(a, first);
- }
-
- JavaCodeStyleManager.getInstance(targetClass.getProject()).shortenClassReferences(modifiers);
- }
-
- return result;
- }
-
public static void runTestMethodTemplate(MethodKind methodKind,
TestFramework framework,
final Editor editor,
- PsiClass targetClass,
+ final PsiClass targetClass,
final PsiMethod method,
- String name,
+ @Nullable String name,
boolean automatic) {
Template template = createTestMethodTemplate(methodKind, framework, targetClass, name, automatic);
- template.setToIndent(true);
- template.setToReformat(true);
- template.setToShortenLongNames(true);
final TextRange range = method.getTextRange();
editor.getDocument().replaceString(range.getStartOffset(), range.getEndOffset(), "");
public void run() {
PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());
PsiFile psi = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
- PsiElement method = psi.findElementAt(range.getStartOffset());
+ PsiElement el = PsiTreeUtil.findElementOfClassAtOffset(psi, editor.getCaretModel().getOffset() - 1, PsiMethod.class, false);
- if (method != null) {
- method = PsiTreeUtil.getParentOfType(method, PsiMethod.class, false);
+ if (el != null) {
+ PsiMethod method = PsiTreeUtil.getParentOfType(el, PsiMethod.class, false);
if (method != null) {
- CreateFromUsageUtils.setupEditor((PsiMethod)method, editor);
+ GenerateMembersUtil.setupGeneratedMethod(method);
+ CreateFromUsageUtils.setupEditor(method, editor);
}
}
}
private static Template createTestMethodTemplate(MethodKind methodKind,
TestFramework descriptor,
PsiClass targetClass,
- String name,
+ @Nullable String name,
boolean automatic) {
FileTemplateDescriptor templateDesc = methodKind.getFileTemplateDescriptor(descriptor);
String templateName = templateDesc.getFileName();
templateText = fileTemplate.getText();
}
+ if (name == null) name = methodKind.getDefaultName();
+
int from = 0;
- while(true) {
+ while (true) {
int index = templateText.indexOf("${NAME}", from);
if (index == -1) break;
if (from == 0) {
Expression nameExpr = new ConstantNode(name);
template.addVariable("name", nameExpr, nameExpr, !automatic);
- } else {
+ }
+ else {
template.addVariableSegment("name");
}
}
template.addTextSegment(templateText.substring(from, templateText.length()));
+ template.setToIndent(true);
+ template.setToReformat(true);
+ template.setToShortenLongNames(true);
+
return template;
}
boolean generateBefore,
boolean generateAfter) throws IncorrectOperationException {
if (generateBefore) {
- generateMethod(TestIntegrationUtils.MethodKind.SET_UP, descriptor, targetClass, editor, "setUp");
+ generateMethod(TestIntegrationUtils.MethodKind.SET_UP, descriptor, targetClass, editor, null);
}
if (generateAfter) {
- generateMethod(TestIntegrationUtils.MethodKind.TEAR_DOWN, descriptor, targetClass, editor, "tearDown");
+ generateMethod(TestIntegrationUtils.MethodKind.TEAR_DOWN, descriptor, targetClass, editor, null);
}
for (MemberInfo m : methods) {
generateMethod(TestIntegrationUtils.MethodKind.TEST, descriptor, targetClass, editor, m.getMember().getName());
public void setUp() throws Exception {
- super.setUp();
+ ${BODY}
}
\ No newline at end of file
<html>
<body>
-<table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
+<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td colspan="3"><font face="verdana" size="-1">
This is a template used by <b>IDEA</b> to create a setUp method in a JUnit 3 test class.
<td width="10"> </td>
<td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
</tr>
+ <tr>
+ <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+ <td width="10"> </td>
+ <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
+ </tr>
</table>
</body>
</html>
\ No newline at end of file
public void tearDown() throws Exception {
- super.tearDown();
+ ${BODY}
}
\ No newline at end of file
<html>
<body>
-<table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
+<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td colspan="3"><font face="verdana" size="-1">
This is a template used by <b>IDEA</b> to create a tearDown method in a JUnit 3 test class.
<td width="10"> </td>
<td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
</tr>
+ <tr>
+ <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+ <td width="10"> </td>
+ <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
+ </tr>
</table>
</body>
</html>
\ No newline at end of file
public void test${NAME}() throws Exception {
+ ${BODY}
}
\ No newline at end of file
<html>
<body>
-<table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
+<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td colspan="3"><font face="verdana" size="-1">
This is a template used by <b>IDEA</b> to create a test method in a JUnit 3 test class.
<td width="10"> </td>
<td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
</tr>
+ <tr>
+ <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+ <td width="10"> </td>
+ <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
+ </tr>
</table>
</body>
</html>
\ No newline at end of file
@org.junit.Before
public void setUp() throws Exception {
+ ${BODY}
}
\ No newline at end of file
<html>
<body>
-<table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
+<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td colspan="3"><font face="verdana" size="-1">
This is a template used by <b>IDEA</b> to create a setUp method in a JUnit 4 test class.</font>
</td>
</tr>
</table>
-</body>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
<td width="10"> </td>
<td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
</tr>
+ <tr>
+ <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+ <td width="10"> </td>
+ <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
+ </tr>
</table>
+</body>
</html>
\ No newline at end of file
@org.junit.After
public void tearDown() throws Exception {
+ ${BODY}
}
\ No newline at end of file
<html>
<body>
-<table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
+<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td colspan="3"><font face="verdana" size="-1">
This is a template used by <b>IDEA</b> to create a tearDown method in a JUnit 4 test class.</font>
</td>
</tr>
</table>
-</body>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
<td width="10"> </td>
<td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
</tr>
+ <tr>
+ <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+ <td width="10"> </td>
+ <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
+ </tr>
</table>
+</body>
</html>
\ No newline at end of file
@org.junit.Test
public void test${NAME}() throws Exception {
+ ${BODY}
}
\ No newline at end of file
<html>
<body>
-<table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
+<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td colspan="3"><font face="verdana" size="-1">
This is a template used by <b>IDEA</b> to create a test method in a JUnit 4 test class.</font>
</td>
</tr>
</table>
-</body>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
<td width="10"> </td>
<td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
</tr>
+ <tr>
+ <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+ <td width="10"> </td>
+ <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
+ </tr>
</table>
+</body>
</html>
\ No newline at end of file
@org.testng.annotations.BeforeMethod
-public void setUp() {
+public void setUp() throws Exception {
+ ${BODY}
}
\ No newline at end of file
<html>
<body>
-<table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
+<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td colspan="3"><font face="verdana" size="-1">
This is a template used by <b>IDEA</b> to create a setUp method in a TestNG test class.</font>
<td width="10"> </td>
<td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
</tr>
+ <tr>
+ <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+ <td width="10"> </td>
+ <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
+ </tr>
</table>
</body>
</html>
\ No newline at end of file
@org.testng.annotations.AfterMethod
-public void tearDown() {
+public void tearDown() throws Exception {
+ ${BODY}
}
\ No newline at end of file
<html>
<body>
-<table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
+<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td colspan="3"><font face="verdana" size="-1">
This is a template used by <b>IDEA</b> to create a tearDown method in a TestNG test class.</font>
<td width="10"> </td>
<td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
</tr>
+ <tr>
+ <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+ <td width="10"> </td>
+ <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
+ </tr>
</table>
</body>
</html>
\ No newline at end of file
@org.testng.annotations.Test
public void test${NAME}() throws Exception {
+ ${BODY}
}
\ No newline at end of file
<html>
<body>
-<table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
+<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td colspan="3"><font face="verdana" size="-1">
This is a template used by <b>IDEA</b> to create a test method in a TestNG test class.</font>
<td width="10"> </td>
<td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
</tr>
+ <tr>
+ <td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
+ <td width="10"> </td>
+ <td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
+ </tr>
</table>
</body>
</html>
\ No newline at end of file