test if a method throws correct exception

Hi,
there is any possibility to generate a particular exception to check with Junit if it's the correct one?
For example, if I have to test a method containing System.in.readln(), that can generate IOException, how can I simulate that exception to check the right behavior of my method, and if Junit test fails or not? Thank you.