source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/src/testcases/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelperTest.java@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 2.3 KB
Line 
1/*
2 * Copyright 2002,2004-2005 The Apache Software Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17package org.apache.tools.ant.taskdefs.optional.junit;
18
19import junit.framework.Test;
20import junit.framework.TestCase;
21import junit.framework.TestResult;
22
23/**
24 */
25public class JUnitVersionHelperTest extends TestCase {
26
27 public JUnitVersionHelperTest(String name) {
28 super(name);
29 }
30
31 public void testMyOwnName() {
32 assertEquals("testMyOwnName",
33 JUnitVersionHelper.getTestCaseName(this));
34 }
35
36 public void testNonTestCaseName() {
37 assertEquals("I'm a foo",
38 JUnitVersionHelper.getTestCaseName(new Foo1()));
39 }
40
41 public void testNoStringReturn() {
42 assertEquals("unknown",
43 JUnitVersionHelper.getTestCaseName(new Foo2()));
44 }
45
46 public void testNoGetName() {
47 assertEquals("unknown",
48 JUnitVersionHelper.getTestCaseName(new Foo3()));
49 }
50
51 public void testNameNotGetName() {
52 assertEquals("I'm a foo, too",
53 JUnitVersionHelper.getTestCaseName(new Foo4()));
54 }
55
56 public void testNull() {
57 assertEquals("unknown", JUnitVersionHelper.getTestCaseName(null));
58 }
59
60 public static class Foo implements Test {
61 public int countTestCases() {return 0;}
62 public void run(TestResult result) {}
63 }
64
65 public static class Foo1 extends Foo {
66 public String getName() {return "I'm a foo";}
67 }
68
69 public static class Foo2 extends Foo {
70 public int getName() {return 1;}
71 }
72
73 public static class Foo3 extends Foo {
74 }
75
76 public static class Foo4 extends Foo {
77 public String name() {return "I'm a foo, too";}
78 }
79
80}
Note: See TracBrowser for help on using the repository browser.