This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Build 200506142000 1) Have a class with a method which throws an exception 2) Create test for this class 3) Compile Test class 4) ERROR: Compilation fails with "unreported exceptions must be caught". I think that code like: try { instance.CALL_METHOD(...); } catch (EXCEPTION_1) { } catch (EXCEPTION_2) { } would be usefull.
The correct solution is to make the exceptions reported by the test method, and thus pass them to the framework, which will report them as errors.
Accepted. I will use the solution suggested by Ondrej Rypacek, i.e. I will just add the throws-clause to the header of the test method. The throws-clause will simply declare throwing of 'java.lang.Exception'.
Fixed in the trunk. If the tested method declares to throw at least one exception other than java.lang.RuntimeException or its subclass, the test method declares to throw java.lang.Exception. Modified file: junit/src/org/netbeans/modules/junit/TestCreator.java (1.52) Diff: http://junit.netbeans.org/source/browse/junit/src/org/netbeans/modules/junit/TestCreator.java?r1=1.51&r2=1.52&diff_format=u
Verified in 20050902-0547.