Tuesday 22 January 2013

Expected Exception Test


import org.testng.annotations.*;
 
/**
 * TestNG Expected Exception Test
  *
 */
public class TestNGTest2 {
 
 @Test(expectedExceptions = ArithmeticException.class)  
 public void divisionWithException() {  
   int i = 1/0;
 }  
 
}

No comments:

Post a Comment