title: How to check multiple exceptions with one JUnit Method?
body: <p>i have this code in my program which is needed to be tested with jUnit</p>
  
  <pre><code> void deleteCustomer(String name) throws UnknownCustomerException,
          AccountNotEmptyException {
      if (name == null) {
          throw new NullPointerException();
      } else if (!exists(name)) {
          throw new UnknownCustomerException();
      } else if (getCustomer(name).deletable()) {
          customerList.remove(getCustomer(name));
      }
  }
  </code></pre>
  
  <p>I thought i can test it in one JUnit method like</p>
  
  <pre><code>   @Test
  public void createCustomer(){
      System.out.println("createCustomerTest");
      try {
          element.createCustomer(null);
          //fail("Expected an IndexOutOfBoundsException to be thrown");
      } catch (NullPointerException anIndexOutOfBoundsException) {
          assertTrue(anIndexOutOfBoundsException.getMessage().equals("NullPointerException"));
      }
  }
  </code></pre>
  
  <p>As you can see I already tried unsuccessfully to implement the NPE. 
  How can I check for several Exceptions in one JUnit Method? I checked some How-To's in the web but failed with that too.</p>