| 9 | import onjava.*; |
| 10 | |
| 11 | public class AtUnitExample3 { |
| 12 | private int n; |
| 13 | public AtUnitExample3(int n) { this.n = n; } |
| 14 | public int getN() { return n; } |
| 15 | public String methodOne() { |
| 16 | return "This is methodOne"; |
| 17 | } |
| 18 | public int methodTwo() { |
| 19 | System.out.println("This is methodTwo"); |
| 20 | return 2; |
| 21 | } |
| 22 | @TestObjectCreate |
| 23 | static AtUnitExample3 create() { |
| 24 | return new AtUnitExample3(47); |
| 25 | } |
| 26 | @Test |
| 27 | boolean initialization() { return n == 47; } |
| 28 | @Test |
| 29 | boolean methodOneTest() { |
| 30 | return methodOne().equals("This is methodOne"); |
| 31 | } |
| 32 | @Test |
| 33 | boolean m2() { return methodTwo() == 2; } |
| 34 | } |
| 35 | /* Output: |
| 36 | annotations.AtUnitExample3 |
| 37 | . initialization |
nothing calls this directly
no outgoing calls
no test coverage detected