History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEA-19210
Type: New Feature New Feature
Status: Open Open
Assignee: Alexey Kudravtsev
Reporter: Mark Vedder
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
IDEA: Feedback

Add a "Add Exception as expected Test exception" to "Unhandled Exception" intention fixes when in JUnit 4 test

Created: 18 Aug 08 22:02   Updated: 19 Aug 08 13:36
Component/s: Editor. Intention Actions

Build: 8,664


 Description  « Hide
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.



 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.