fix "Usage of obsolete 'junit.framework.Assert'" inspection's problem descriptor

This commit is contained in:
Bas Leijdekkers
2013-12-03 14:54:38 +01:00
parent a70038ad20
commit 64507641bd
3 changed files with 53 additions and 1 deletions
@@ -1944,7 +1944,7 @@ class.only.used.in.one.package.display.name=Class only used from one other packa
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 'org.junit.framework.Assert' should be replaced with call to method from 'org.junit.Assert' #loc
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
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()'
@@ -0,0 +1,8 @@
package com.siyeh.igtest.junit.use_of_obsolete_assert;
public class ObsoleteAssert {
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);
}
}
@@ -0,0 +1,44 @@
/*
* Copyright 2000-2013 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.siyeh.ig.junit;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.siyeh.ig.LightInspectionTestCase;
/**
* @author Bas Leijdekkers
*/
public class UseOfObsoleteAssertInspectionTest extends LightInspectionTestCase {
public void testObsoleteAssert() { doTest(); }
@Override
protected String[] getEnvironmentClasses() {
return new String[] {
"package junit.framework;" +
"public class Assert {" +
" static public void assertEquals(String message, int expected, int actual) {}" +
"}",
"package org.junit;" +
"public class Assert {}"
};
}
@Override
protected InspectionProfileEntry getInspection() {
return new UseOfObsoleteAssertInspection();
}
}