// I Junit 3:
public
void
testMethod
(
)
{
Exception
e
=
null
;
try
{
doStuff
(
)
;
}
catch
(
Exception
e_
)
{
e
=
e_
;
}
assertNotNull
(
e
)
;
}
// I JUnit 4:
@Test
(
expected
=
SomeException.
class
)
void
testMethod
(
)
throws
Exception
{
doStuff
(
)
;
}