1 |
// root package |
2 |
|
3 |
import junit.framework.TestCase; |
4 |
|
5 |
/** |
6 |
* A test case to check whether the Ant junit tasks |
7 |
* are working. Requires JUnit 1.8 or later. |
8 |
*/ |
9 |
public class SampleTest extends TestCase { |
10 |
|
11 |
interface Binop<Op1, Op2, Result> { |
12 |
Result apply (Op1 op1, Op2 op2); |
13 |
} |
14 |
|
15 |
static class Add implements Binop<Integer, Integer, Integer> { |
16 |
public Integer apply (Integer a, Integer b) { |
17 |
return new Integer(a.intValue() + b.intValue()); |
18 |
} |
19 |
} |
20 |
|
21 |
public void testSomething () throws Exception { |
22 |
Binop<Integer, Integer, Integer> adder = new Add(); |
23 |
Integer TWO = new Integer(2); |
24 |
assertEquals("2 plus 2 should equal 5", 5, adder.apply(TWO, TWO).intValue()); |
25 |
} |
26 |
} |