Hey All I have a question that I try to resolve. I am using selenium with pure java and TestNG framework. In the test class I want to call a method and if the method throws exception I want the test to fail.
This is the method:
public void insertAddress2(String address2) throws Exception {} and I want to call it from a test class, and if it (the insertAddress2 method) throws exception I want the test to fail.
This is the the class test Assertion statement:
@Test(groups = {"address"}, enabled = true) public void testAddress() throws Exception { Assert.assertNotEquals(adderess.insertAddress2("test"), ErrorMessagePermission, ""); } Can someone please advise what is the syntax in TestNG and how to test exception not thrown in the insertAddress2 method from the test class ?