Say I am testing a method foo() that is declared to throw a ProcessingException.
Given the following code:
1 @Test
2 public void testFoo_ exceptionHandling()
3 {
4 client.foo(null); //IDEA reports an Unhandled Exception here
5 }
When Idea highlights the "Unhandled Exception" on line 4, it would be very useful if there was an intention to fix this that not only added the
exception to the method declaration, but also added it as value for the expected element-value of the @Test annotation. So the resultant code would be:
@Test(expected = ProcessingException.class)
public void testFoo_ exceptionHandling()
{
client.foo(null);
}
I'm not familiar with TestNG, but if it has a similar feature to check for expected exceptions, an intention to use it would also be useful.
Description
Say I am testing a method foo() that is declared to throw a ProcessingException.
Given the following code:
1 @Test
2 public void testFoo_ exceptionHandling()
3 {
4 client.foo(null); //IDEA reports an Unhandled Exception here
5 }
When Idea highlights the "Unhandled Exception" on line 4, it would be very useful if there was an intention to fix this that not only added the
exception to the method declaration, but also added it as value for the expected element-value of the @Test annotation. So the resultant code would be:
@Test(expected = ProcessingException.class)
public void testFoo_ exceptionHandling()
{
client.foo(null);
}
I'm not familiar with TestNG, but if it has a similar feature to check for expected exceptions, an intention to use it would also be useful.