title: JUnit 4 Expected Exception type
body: <p>I am trying to do a JUnit test on code that someone else has written, but I cannot figure out how to test for the exception, because the exception seems to lack a type.</p>
  
  <pre><code>public Pirate(String name, int initialGold) throws Exception {
      if(initialGold &lt; 0)
          throw new Exception("Init Gold must be &gt;= 0");
      this.name = name;
      this.numGold = initialGold;
      this.health = Pirate.DEFAULT_HEALTH;
      this.isCursed = false;
  }
  </code></pre>
  
  <p>My JUnit Code snippet:</p>
  
  <pre><code>@Test
  public static void constructorTest() throws Exception{
      rodgers = new Pirate("Dread Pirate Rodgers", 10000);
      assertEquals("Dread Pirate Rodgers" , rodgers.getName());
      assertEquals(10000, rodgers.getNumGold());
      assertEquals(100, rodgers.getHealth());
      assertEquals(false, rodgers.getIsCursed());
  }
  
  @Test()
  public static void exceptionTest() throws Exception{
      rodgers = new Pirate("Dread Pirate Rodgers" , -100);
  
  }
  </code></pre>
  
  <p>I know I need to put expected = (some type of exception) in the parenthesis of test, but I am clueless as to the exception type.</p>