### Question:
InfluxException extends RuntimeException { public int status() { if (response != null) { return response.code(); } return 0; } InfluxException(@Nullable final String message);  InfluxException(@Nullable final Throwable cause);  InfluxException(@Nullable final Response<?> cause); @Override String getMessage(); int reference(); int status(); @Nonnull JSONObject errorBody();  }### Answer:
@Test void statusResponse() { Assertions .assertThatThrownBy(() -> { throw new InfluxException(new HttpException(errorResponse("Wrong query", 501))); }) .matches((Predicate<Throwable>) throwable -> ((InfluxException) throwable).status() == 501); }
@Test void statusResponseNull() { Assertions .assertThatThrownBy(() -> { throw new InfluxException(new IllegalStateException("unExpectedError")); }) .matches((Predicate<Throwable>) throwable -> ((InfluxException) throwable).status() == 0); }