History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-23537
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Normal Normal
Assignee: Bas Leijdekkers
Reporter: Jacques Morel
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

JUnit Simplify assertion inspection too aggressive

Created: 29 Nov 07 13:04   Updated: 20 Dec 07 09:43
Component/s: Code Analysis. Inspection
Fix Version/s: Diana 8243, Selena 7.0.3

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
File Attachments: None
Image Attachments:

1. JUnitSimplifyInspectionTooAggressive.jpg
(59 kb)
Environment: WinXP SP2 JDK1.6_03

Build: 7,562
Fixed in build: 7,579
Severity: Low


 Description  « Hide
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) {
       }
    
    }


 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.