diff options
Diffstat (limited to 'plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/ReplaceAssertEqualsWithAssertLiteralIntention.java')
-rw-r--r-- | plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/ReplaceAssertEqualsWithAssertLiteralIntention.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/ReplaceAssertEqualsWithAssertLiteralIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/ReplaceAssertEqualsWithAssertLiteralIntention.java index cb27659e0cc2..e972b18665ae 100644 --- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/ReplaceAssertEqualsWithAssertLiteralIntention.java +++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/ReplaceAssertEqualsWithAssertLiteralIntention.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2013 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2014 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,8 +15,8 @@ */ package com.siyeh.ipp.junit; -import com.intellij.codeInsight.AnnotationUtil; import com.intellij.psi.*; +import com.intellij.psi.util.InheritanceUtil; import com.intellij.psi.util.PsiTreeUtil; import com.siyeh.IntentionPowerPackBundle; import com.siyeh.ig.PsiReplacementUtil; @@ -86,11 +86,10 @@ public class ReplaceAssertEqualsWithAssertLiteralIntention extends MutablyNamedI final PsiElement qualifier = expression.getQualifier(); @NonNls final StringBuilder newExpression = new StringBuilder(); if (qualifier == null) { - final PsiMethod containingMethod = PsiTreeUtil.getParentOfType(call, PsiMethod.class); - if (containingMethod != null && AnnotationUtil.isAnnotated(containingMethod, "org.junit.Test", true)) { - if (!ImportUtils.addStaticImport("org.junit.Assert", assertString, element)) { - newExpression.append("org.junit.Assert."); - } + final PsiClass containingClass = PsiTreeUtil.getParentOfType(element, PsiClass.class); + if (!InheritanceUtil.isInheritor(containingClass, "junit.framework.Assert") && + !ImportUtils.addStaticImport("org.junit.Assert", assertString, element)) { + newExpression.append("org.junit.Assert."); } } else { |