Priority
Normal
Type
Bug 
State
Fixed 
Assignee
Bas Leijdekkers 
Subsystem
Code Analysis. Inspection 
Affected versions
Fixed in
Fixed in build
Next build 
Build
7562
Fixed in build
7579
Severity
0
  • Submitted by   Jacques Morel
    2 years ago (29 Nov 2007 13:04)
  • Updated by   root
    3 weeks ago (17 Jan 2010 19:55)
  • Jira: IDEA-42140
    (history, comments)

IDEA-42140

JUnit Simplify assertion inspection too aggressive

0
Added by <no user>
15 Sep 2009
JUnitSimplifyInspectionTooAggressive.jpg   (58 KB)

I don't think the inspection should flag overwritten {{assertEquals}} just because their second argument is null or a boolean, regardless of
  1. where the {{assertEquals}} come from (trigger the inspection only on {{TestCase}} methods)
  2. the type and number of parameters (at least verify that the signature are a potential for simplification i.e. have 2 parameters of assignable types 3 parameters if the first one is a String and the 2 last are assignable)
import junit.framework.TestCase;

public class IDEABugTest extends TestCase {
   public static enum Input { value1 }

   public void testAssertEqualsSimplificationShouldNotSimplifyOverridenAssertEquals() throws Exception {
      assertEquals(Input.value1, null, new Exception()); 
      assertEquals("value1", null, new Exception());      
      assertEquals("value1", true, new Exception());
   }

   @SuppressWarnings({"UnusedDeclaration"})
   public static void assertEquals(Enum expectedValue1, Integer expectedValue2, Exception actual) {
   }

   @SuppressWarnings({"UnusedDeclaration"})
   public static void assertEquals(String expectedValue1, Integer expectedValue2, Exception actual) {
   }

}


Environment: WinXP SP2 JDK1.6_03

Issue was resolved
Comments (0)
 
History (1)
 
Links
 
Issue has no comments