class.only.used.in.one.package.display.name=Class only used from one other package
class.only.used.in.one.package.problem.descriptor=Class <code>#ref</code> has only dependencies on and/or dependents in package ''{0}'' #loc
unnecessary.return.option=Ignore in then branch of 'if' statement with 'else' branch
-usage.of.obsolete.assert.display.name=Usage of obsolete 'junit.framework.Assert'
-use.of.obsolete.assert.problem.descriptor=Call to <code>#ref()</code> from 'junit.framework.Assert' should be replaced with call to method from 'org.junit.Assert' #loc
+usage.of.obsolete.assert.display.name=Usage of obsolete 'junit.framework.Assert' method
+use.of.obsolete.assert.problem.descriptor=Call to <code>#ref()</code> from ''{0}'' should be replaced with call to method from ''org.junit.Assert'' #loc
use.of.obsolete.assert.quickfix=Replace with 'org.junit.Assert' method call
properties.object.as.hashtable.set.quickfix=Replace with call to 'setProperty()'
properties.object.as.hashtable.get.quickfix=Replace with call to 'getProperty()'
/*
- * Copyright 2003-2014 Dave Griffith, Bas Leijdekkers
+ * Copyright 2003-2016 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.
@Override
@NotNull
protected String buildErrorString(Object... infos) {
- return InspectionGadgetsBundle.message("use.of.obsolete.assert.problem.descriptor");
+ String name = (String)infos[0];
+ return InspectionGadgetsBundle.message("use.of.obsolete.assert.problem.descriptor", name);
}
@Override
return;
}
final PsiClass containingClass = psiMethod.getContainingClass();
- if (containingClass != null && Comparing.strEqual(containingClass.getQualifiedName(), "junit.framework.Assert")) {
- registerMethodCallError(expression);
+ if (containingClass == null) {
+ return;
+ }
+ final String name = containingClass.getQualifiedName();
+ if ("junit.framework.Assert".equals(name) || "junit.framework.TestCase".equals(name)) {
+ registerMethodCallError(expression, name);
}
}
}
public void testMe(int s) {
junit.framework.Assert.<warning descr="Call to 'assertEquals()' from 'junit.framework.Assert' should be replaced with call to method from 'org.junit.Assert'">assertEquals</warning>("asdfasd", -1, s);
+ junit.framework.TestCase.<warning descr="Call to 'assertEquals()' from 'junit.framework.TestCase' should be replaced with call to method from 'org.junit.Assert'">assertEquals</warning>("asdfasd", -1, s);
}
}
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * 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.
"public class Assert {" +
" static public void assertEquals(String message, int expected, int actual) {}" +
"}",
+
+ "package junit.framework;" +
+ "public class TestCase extends Assert {" +
+ " public static void assertEquals(String message, int expected, int actual) {" +
+ " Assert.assertEquals(message, expected, actual);" +
+ " }" +
+ "}",
+
"package org.junit;" +
"public class Assert {}"
};