Reputation: 124656
When I use the Create Test feature of IntelliJ IDEA, it generates test cases with a throws Exception
clause, for example:
@Test public void testIsInteger() throws Exception { }
This annoys me a bit: I prefer to add the specific throws
clauses myself only when necessary.
That way I see at a glance what kind of exceptions might be thrown by each test case.
How can I change this behavior of IntelliJ to omit the throws
clause?
Or am I wrong to want this? The creators seem to think this default behavior is a good thing.
Upvotes: 6
Views: 982
Reputation: 34776
You can go into Settings/File and Code Templates/Code tab and change the template for the JUnit test method (there are templates both for JUnit 3 and JUnit 4 test methods).
That should do the trick.
Upvotes: 7