blob: 1bc43edc42045841581fda42fa02d77fe0c45044 (
plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
|
package org.kohsuke.args4j;
public class InheritanceTest extends Args4JTestBase<Inheritance> {
@Override
public Inheritance getTestObject() {
return new Inheritance();
}
public void testMyself() {
args = new String[]{"-m","Thats me"};
Inheritance bo = testObject;
try {
parser.parseArgument(args);
assertEquals("Value for class itself not arrived", "Thats me", bo.me);
} catch (CmdLineException e) {
fail("This exception should not occur");
}
}
public void testFather() {
args = new String[]{"-f","My father"};
Inheritance bo = testObject;
try {
parser.parseArgument(args);
assertEquals("Value for class itself not arrived", "My father", bo.father);
} catch (CmdLineException e) {
fail("This exception should not occur");
}
}
public void testGrandfather() {
args = new String[]{"-g","My fathers father"};
Inheritance bo = testObject;
try {
parser.parseArgument(args);
assertEquals("Value for class itself not arrived", "My fathers father", bo.grandpa);
} catch (CmdLineException e) {
fail("This exception should not occur");
}
}
public void testMother() {
args = new String[]{"-mom","Hi Mom"};
Inheritance bo = testObject;
try {
parser.parseArgument(args);
assertNull("Annotations are not designed for use in interfaces", bo.mom);
} catch (CmdLineException e) {
//no-op
}
}
}
|