Skip to content

Commit 2490250

Browse files
committed
Removed the unused constructors, suite() and teardown() methods from the test cases
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/branches/cli-1.x@661358 13f79535-47bb-0310-9956-ffa450edef68
1 parent d72a578 commit 2490250

24 files changed

Lines changed: 120 additions & 340 deletions

src/test/org/apache/commons/cli/ApplicationTest.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.commons.cli;
1819

19-
import junit.framework.Test;
2020
import junit.framework.TestCase;
21-
import junit.framework.TestSuite;
2221

2322
/**
2423
* <p>
@@ -37,15 +36,6 @@
3736
*/
3837
public class ApplicationTest extends TestCase {
3938

40-
public static Test suite() {
41-
return new TestSuite(ApplicationTest.class);
42-
}
43-
44-
public ApplicationTest(String name)
45-
{
46-
super(name);
47-
}
48-
4939
/**
5040
*
5141
*/

src/test/org/apache/commons/cli/ArgumentIsOptionTest.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,22 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.commons.cli;
1819

19-
import junit.framework.Test;
2020
import junit.framework.TestCase;
21-
import junit.framework.TestSuite;
22-
2321

2422
public class ArgumentIsOptionTest extends TestCase {
2523
private Options options = null;
2624
private CommandLineParser parser = null;
2725

28-
public ArgumentIsOptionTest(String name) {
29-
super(name);
30-
}
31-
32-
public static Test suite() {
33-
return new TestSuite(ArgumentIsOptionTest.class);
34-
}
35-
3626
public void setUp() {
3727
options = new Options().addOption("p", false, "Option p").addOption("attr",
3828
true, "Option accepts argument");
3929

4030
parser = new PosixParser();
4131
}
4232

43-
public void tearDown() {
44-
}
45-
4633
public void testOptionAndOptionWithArgument() {
4734
String[] args = new String[] {
4835
"-p",

src/test/org/apache/commons/cli/BugsTest.java

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.commons.cli;
1819

1920
import java.io.ByteArrayOutputStream;
@@ -22,33 +23,10 @@
2223
import java.io.StringWriter;
2324
import java.util.Properties;
2425

25-
import junit.framework.Test;
2626
import junit.framework.TestCase;
27-
import junit.framework.TestSuite;
2827

2928
public class BugsTest extends TestCase
3029
{
31-
/** CommandLine instance */
32-
private CommandLine _cmdline = null;
33-
private Option _option = null;
34-
35-
public static Test suite() {
36-
return new TestSuite( BugsTest.class );
37-
}
38-
39-
public BugsTest( String name )
40-
{
41-
super( name );
42-
}
43-
44-
public void setUp()
45-
{
46-
}
47-
48-
public void tearDown()
49-
{
50-
}
51-
5230
public void test11457() {
5331
Options options = new Options();
5432
options.addOption( OptionBuilder.withLongOpt( "verbose" )

src/test/org/apache/commons/cli/BuildTest.java

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,13 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.commons.cli;
1819

19-
import junit.framework.Test;
2020
import junit.framework.TestCase;
21-
import junit.framework.TestSuite;
2221

2322
public class BuildTest extends TestCase
2423
{
25-
26-
public static Test suite() {
27-
return new TestSuite(BuildTest.class);
28-
}
29-
30-
public BuildTest(String name)
31-
{
32-
super(name);
33-
}
34-
35-
public void setUp()
36-
{
37-
38-
}
39-
40-
public void tearDown()
41-
{
42-
43-
}
44-
4524
public void testSimple()
4625
{
4726
Options opts = new Options();

src/test/org/apache/commons/cli/GnuParseTest.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,13 @@
1616
*/
1717
package org.apache.commons.cli;
1818

19-
import junit.framework.Test;
2019
import junit.framework.TestCase;
21-
import junit.framework.TestSuite;
2220

2321
public class GnuParseTest extends TestCase
2422
{
2523
private Options _options = null;
2624
private Parser _parser = null;
2725

28-
public static Test suite() {
29-
return new TestSuite( GnuParseTest.class );
30-
}
31-
32-
public GnuParseTest( String name )
33-
{
34-
super( name );
35-
}
36-
3726
public void setUp()
3827
{
3928
_options = new Options()
@@ -53,11 +42,6 @@ public void setUp()
5342
_parser = new GnuParser( );
5443
}
5544

56-
public void tearDown()
57-
{
58-
59-
}
60-
6145
public void testSimpleShort()
6246
{
6347
String[] args = new String[] { "-a",
@@ -129,14 +113,13 @@ public void testExtraOption()
129113

130114
public void testMissingArg()
131115
{
132-
133116
String[] args = new String[] { "-b" };
134117

135118
boolean caught = false;
136119

137120
try
138121
{
139-
CommandLine cl = _parser.parse(_options, args);
122+
_parser.parse(_options, args);
140123
}
141124
catch (MissingArgumentException e)
142125
{

src/test/org/apache/commons/cli/HelpFormatterExamples.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.commons.cli;
1819

1920
/**

src/test/org/apache/commons/cli/HelpFormatterTest.java

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.commons.cli;
1819

1920
import java.io.ByteArrayOutputStream;
2021
import java.io.PrintWriter;
21-
2222
import java.util.Comparator;
2323

2424
import junit.framework.TestCase;
25-
import junit.framework.TestSuite;
2625

2726
/**
2827
* Test case for the HelpFormatter class
@@ -33,7 +32,6 @@
3332
**/
3433
public class HelpFormatterTest extends TestCase
3534
{
36-
3735
private static final String EOL = System.getProperty("line.separator");
3836

3937
public static void main( String[] args )
@@ -42,18 +40,7 @@ public static void main( String[] args )
4240
junit.textui.TestRunner.main(testName);
4341
}
4442

45-
public static TestSuite suite()
46-
{
47-
return new TestSuite(HelpFormatterTest.class);
48-
}
49-
50-
public HelpFormatterTest( String s )
51-
{
52-
super( s );
53-
}
54-
55-
public void testFindWrapPos()
56-
throws Exception
43+
public void testFindWrapPos() throws Exception
5744
{
5845
HelpFormatter hf = new HelpFormatter();
5946

@@ -67,8 +54,7 @@ public void testFindWrapPos()
6754
assertEquals("wrap position 3", 4, hf.findWrapPos(text, 3, 0));
6855
}
6956

70-
public void testPrintWrapped()
71-
throws Exception
57+
public void testPrintWrapped() throws Exception
7258
{
7359
StringBuffer sb = new StringBuffer();
7460
HelpFormatter hf = new HelpFormatter();
@@ -116,8 +102,7 @@ public void testPrintWrapped()
116102
assertEquals("multi-line padded text", expected, sb.toString());
117103
}
118104

119-
public void testPrintOptions()
120-
throws Exception
105+
public void testPrintOptions() throws Exception
121106
{
122107
StringBuffer sb = new StringBuffer();
123108
HelpFormatter hf = new HelpFormatter();
@@ -169,8 +154,7 @@ public void testPrintOptions()
169154
assertEquals("multiple wrapped options", expected, sb.toString());
170155
}
171156

172-
public void testAutomaticUsage()
173-
throws Exception
157+
public void testAutomaticUsage() throws Exception
174158
{
175159
HelpFormatter hf = new HelpFormatter();
176160
Options options = null;

src/test/org/apache/commons/cli/LongOptionWithShort.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,18 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.commons.cli;
1819

19-
import junit.framework.Test;
2020
import junit.framework.TestCase;
21-
import junit.framework.TestSuite;
22-
2321

2422
/**
25-
* <p>
2623
* This is a collection of tests that test real world
2724
* applications command lines focusing on options with
2825
* long and short names.
29-
* </p>
3026
*/
3127
public class LongOptionWithShort extends TestCase {
32-
public LongOptionWithShort(String name) {
33-
super(name);
34-
}
35-
36-
public static Test suite() {
37-
return new TestSuite(LongOptionWithShort.class);
38-
}
3928

40-
/**
41-
*
42-
*/
4329
public void testLongOptionWithShort() {
4430
Option help = new Option("h", "help", false, "print this message");
4531
Option version = new Option("v", "version", false,

src/test/org/apache/commons/cli/OptionBuilderTest.java

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,13 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.commons.cli;
1819

19-
import junit.framework.Test;
2020
import junit.framework.TestCase;
21-
import junit.framework.TestSuite;
22-
23-
import junit.textui.TestRunner;
2421

2522
public class OptionBuilderTest extends TestCase {
2623

27-
public OptionBuilderTest( String name ) {
28-
super( name );
29-
}
30-
31-
public static Test suite() {
32-
return new TestSuite( OptionBuilderTest.class );
33-
}
34-
35-
public static void main( String args[] ) {
36-
TestRunner.run( suite() );
37-
}
38-
3924
public void testCompleteOption( ) {
4025
Option simple = OptionBuilder.withLongOpt( "simple option")
4126
.hasArg( )
@@ -162,4 +147,4 @@ public void testIllegalOptions() {
162147
fail( "IllegalArgumentException caught" );
163148
}
164149
}
165-
}
150+
}

0 commit comments

Comments
 (0)