title: error compiling junit test with expect exception
body: <p>I am having difficulty using junit 4's expected annotation to look at exceptions. I can't compile the code because there's an unhandled exception. </p>
  
  <p>Here's a simple example that creates the situation:</p>
  
  <pre>
  <code>
  import static org.junit.Assert.*;
  import java.io.UnsupportedEncodingException;
  import org.junit.Test;
  
  public class Simple {
      @Test(expected=UnsupportedEncodingException.class)
      public void simpleTest(){
          String a = "";
          a.getBytes("UTF-123");
      }
  }
  </code>
  </pre>
  
  <p>I get a compilation error saying "Unhandled exception type UnsupportedEncodingException"</p>
  
  <p>This makes sense, and I can fix this by declaring that simpleTest throws UnsupportedEncodingException but I've seen lots of examples online where people don't do that (which would be nice, when writing lots of test cases). </p>
  
  <p>Is there a way to configure the test case so that I don't have to explicitly declare what exceptions will be thrown? </p>