-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathBadSuiteMethod.qhelp
More file actions
41 lines (29 loc) · 1.14 KB
/
BadSuiteMethod.qhelp
File metadata and controls
41 lines (29 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>
JUnit 3.8 requires that a <code>suite</code> method for defining a <code>TestSuite</code> that will
be used by a <code>TestRunner</code> has a specific signature. If the <code>suite</code>
method does not have the expected signature, JUnit does not detect the method as a
<code>suite</code> method.</p>
</overview>
<recommendation>
<p>
Make sure that <code>suite</code> methods in junit <code>TestCase</code> classes are declared both <code>public</code> and
<code>static</code>, and that they have a return type of <code>junit.framework.Test</code> or one of its subtypes.
</p>
</recommendation>
<example>
<p>In the following example, <code>BadSuiteMethod.suite</code> is not detected by JUnit because it is
not declared <code>public</code>. However, <code>CorrectSuiteMethod.suite</code> <em>is</em> detected by JUnit
because it has the expected signature.</p>
<sample src="BadSuiteMethod.java" />
</example>
<references>
<li>
JUnit: <a href="http://junit.sourceforge.net/junit3.8.1/doc/cookbook/cookbook.htm">JUnit Cookbook</a>.
</li>
</references>
</qhelp>