01: package test.triangle;
02:
03: /**
04: * this test checks the CountCalls's static counter to see if we got the
05: * expected number of calls
06: */
07: public class CheckCount {
08:
09: /**
10: * @testng.test parameters="expected-calls"
11: */
12: public void testCheckCountDeprecated(String expectedCalls) {
13: try {
14:
15: // System.out.println("\n\ntestCheckCount time = " + System.currentTimeMillis());
16: int i = (Integer.valueOf(expectedCalls)).intValue();
17: int numCalls = CountCalls.getNumCalls();
18: assert (numCalls == i) : "Count calls expected " + i
19: + " but got " + numCalls;
20: } catch (NumberFormatException nfe) {
21: assert false : "CountCalls needs an expected-calls numeric parameter";
22: }
23: }
24:
25: /**
26: * @testng.parameters value = "expected-calls"
27: * @testng.test
28: */
29: public void testCheckCount(String expectedCalls) {
30: try {
31:
32: // System.out.println("\n\ntestCheckCount time = " + System.currentTimeMillis());
33: int i = (Integer.valueOf(expectedCalls)).intValue();
34: int numCalls = CountCalls.getNumCalls();
35: assert (numCalls == i) : "Count calls expected " + i
36: + " but got " + numCalls;
37: } catch (NumberFormatException nfe) {
38: assert false : "CountCalls needs an expected-calls numeric parameter";
39: }
40: }
41: }
|