title: How to catch this custom Java exception?
body: <p>I've got the following unit test:</p>
  
  <pre><code>public class Update {
  
      @Rule
      public final ExpectedException exception = ExpectedException.none();
  
      private Update update;
  
      @Before
      public void setUp(){
          this.update = new Update();
      }
  
      @Test
      public void validateThrowsExceptionIfMissingId() throws BadParameterException {
          this.update.setId(null);
  
          exception.expect(NotFoundException.class);
          exception.expectMessage("Error");
          this.categoryUpdateRequest.validate();
      }
  }
  </code></pre>
  
  <p>Which is expecting a custom NotFoundException I am throwing. The problem is that, even I can see the exception is being thrown in the console, my test is not getting it:</p>
  
  <pre><code>com.project.api.exception.NotFoundException: Error.
  </code></pre>
  
  <p>Any hint please?</p>