TestNG : Java Testing Next Generation :: Exception Example
TestNG Exception Example |
It is used to test the exception throw by the method.
package com.javaskool;
import org.testng.annotations.Test;
public class TestExample {
@Test(expectedExceptions = ArithmeticException.class)
public void ExceptionInDivision() {
int i = 1/0;
}
@Test(expectedExceptions = NullPointerException.class)
public void NullPointerExceptionInMethod() {
String s=null;
int len=s.length();
}
}
Downloads Examples |
Recent Comments