### Question:
InfluxException extends RuntimeException { public int reference() { String reference = null; if (response != null) { reference = this.response.headers().get("X-Influx-Reference"); } if (reference != null) { return Integer.valueOf(reference); } 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 reference() { Assertions .assertThatThrownBy(() -> { throw new InfluxException(new HttpException(errorResponse("Wrong query", 501, 15))); }) .matches((Predicate<Throwable>) throwable -> ((InfluxException) throwable).reference() == 15); }
@Test void referenceResponseNull() { Assertions .assertThatThrownBy(() -> { throw new InfluxException(new IllegalStateException("unExpectedError")); }) .matches((Predicate<Throwable>) throwable -> ((InfluxException) throwable).reference() == 0); }
@Test void referenceResponseWithoutHeader() { Assertions .assertThatThrownBy(() -> { throw new InfluxException(new HttpException(errorResponse("Wrong query"))); }) .matches((Predicate<Throwable>) throwable -> ((InfluxException) throwable).reference() == 0); }