Menu

#659 JUnitTestShouldIncludeAssert false positive

open
nobody
None
5
2014-09-05
2007-03-21
No

package org.sourceforge.pmd.test;

import junit.framework.TestCase;

public class AssertTest extends TestCase {

public AssertTest(String test) {
super(test);
}

public void testSomething() { // <-- Incorrect violation reported
moveToSomeState();
doTestState();
moveToOtherState();
doTestState();
}

private void doTestState() {
assertEquals("Some assert", 1, 2-1);
}

private void moveToSomeState() {
// ...
}

private void moveToOtherState() {
// ...
}

}

Discussion

  • Dave Cronin

    Dave Cronin - 2008-02-01

    Logged In: YES
    user_id=1983058
    Originator: NO

    This check has a lot of false positives especially when using custom assert methods, which is a recognised JUnit testing pattern.

     
  • Daniel Gredler

    Daniel Gredler - 2014-09-05

    This check would be nice, if it weren't so buggy...

     

Log in to post a comment.