CheckCount.java :  » Testing » testng » test » triangle » Java Open Source

Java Open Source » Testing » testng 
testng » test » triangle » CheckCount.java
package test.triangle;


/**
 * this test checks the CountCalls's static counter to see if we got the
 * expected number of calls
 */
public class CheckCount {
  
  /**
   * @testng.test parameters="expected-calls"
   */
  public void testCheckCountDeprecated(String expectedCalls) {
    try {

      //      System.out.println("\n\ntestCheckCount time = " + System.currentTimeMillis());
      int i = (Integer.valueOf(expectedCalls)).intValue();
      int numCalls = CountCalls.getNumCalls();
      assert (numCalls == i)  : "Count calls expected " + i + " but got " + numCalls;
    } catch (NumberFormatException nfe) {
      assert false : "CountCalls needs an expected-calls numeric parameter";
    }
  }

  /**
   * @testng.parameters value = "expected-calls"
   * @testng.test
   */
  public void testCheckCount(String expectedCalls) {
    try {

      //      System.out.println("\n\ntestCheckCount time = " + System.currentTimeMillis());
      int i = (Integer.valueOf(expectedCalls)).intValue();
      int numCalls = CountCalls.getNumCalls();
      assert (numCalls == i)  : "Count calls expected " + i + " but got " + numCalls;
    } catch (NumberFormatException nfe) {
      assert false : "CountCalls needs an expected-calls numeric parameter";
    }
  }  
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.