title: How do I verify the HTTP status code if it is a subclass of WebApplicationException?
body: <p>I am trying to test that my controller will indeed throw an error with the response code of 409 conflict. My controller looks like this:</p>
  <pre><code>if (Object != null) {
      return Object;
  } else {
      throw new WebApplicationException(Response.Status.CONFLICT);
  }
  </code></pre>
  <p>In the unit test I have something like this:</p>
  <pre><code>assertThrows(WebApplicationException.class, () -&gt; controller.createObject();
  </code></pre>
  <p>Although I feel like this test isn't comprehensive enough as I haven't verified the response code of the call. How does one do that, if it is possible?</p>