package testngdemo;

import org.testng.annotations.*;
import skilledmonter.example.CalculatorService;
import skilledmonter.example.SimpleCalculator;

/**
 * Created by duongnapham on 1/10/18.
 */
public class TestNGAnnotationExceptionExampleTest {
    public CalculatorService service;

    @BeforeClass
    public void init() {
        System.out.println("@BeforeClass: The annotated method will be run before the first test method in the current class is invoked.");
        System.out.println("init service");
        service = new SimpleCalculator();
    }

    @Test(expectedExceptions = ArithmeticException.class)
    public void testDiv() {
        System.out.println("@Test : testDiv()");
        int result = service.div(1, 0);
    }

    @Test(expectedExceptions = ArithmeticException.class)
    public void testSum() {
        System.out.println("@Test : testDiv()");
        int result = service.sum(1, 0);
    }
}

@@ -14,16 +14,42 @@
 gdemo;%0A%0A
+import org.testng.Assert;%0A
 import o
@@ -893,54 +893,453 @@
 test
-Div()%22);%0A        int result = service.sum
+Sum()%22);%0A        int result = service.sum(1, 0);%0A    %7D%0A%0A    @Test(enabled = false)%0A    public void testMultiply() %7B%0A        System.out.println(%22@Test : testMultiple() -%3E enable=false%22);%0A        int result = service.multiply(10, 5);%0A        Assert.assertEquals(result, 50);%0A    %7D%0A%0A    @Test%0A    public void testSub() %7B%0A        System.out.println(%22@Test : testSub()%22);%0A        int result = service.sub
 (1
+0
 , 
-0
+5);%0A        Assert.assertEquals(result, 5
 );%0A 

add skip test