False positive in squid:S2187 (TestCases should contain tests)

146 views
Skip to first unread message

laforest...@gmail.com

unread,
Mar 28, 2018, 5:42:04 AM3/28/18
to SonarQube
Hello,

I think the Rule squid:S2187 should not raise an issue regarding the following example:

import de.bechte.junit.runners.context.HierarchicalContextRunner;
import org.junit.Test;
import static org.junit.Assert.*;

@RunWith(HierarchicalContextRunner.class)
public class ClassTest {

   
public class Test1 {
       
       
@Test
       
public void test() {
            assertTrue
(true);
       
}

   
}

   
public class Test2 {
       
       
@Test
       
public void test() {
            assertTrue
(true);
       
}

   
}

}

I'm using SonarQube 7.0.0 and SonarJava 5.2 and whenever Sonar checks this class, this warning is thrown : "Add some tests to this class"

Is there a way to get rid of this unexpected warning?

Nicolas Peru

unread,
Apr 27, 2018, 9:59:13 AM4/27/18
to laforest...@gmail.com, SonarQube
Hi, 

how are you analyzing this file ? are you providing the dependencies of your project properly through sonar.java.libraries ?

Cheers. 

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/0c3d370e-ce7a-4868-bfb3-503f4994e41a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Nicolas Peru | SonarSource
Reply all
Reply to author
Forward
0 new messages