Shutdown extends CommonCommand<Shutdown> { public static Shutdown getInstance(final ShutdownReason shutdownReason, final DittoHeaders dittoHeaders) { return new Shutdown(shutdownReason, dittoHeaders); } private  Shutdown(final ShutdownReason theReason, final DittoHeaders dittoHeaders); static Shutdown getInstance(final ShutdownReason shutdownReason, final DittoHeaders dittoHeaders); static Shutdown fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); ShutdownReason getReason(); @Override Shutdown setDittoHeaders(final DittoHeaders dittoHeaders); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); static final String TYPE; }
@Test public void tryToGetInstanceWithNullReason() { assertThatNullPointerException() .isThrownBy(() -> Shutdown.getInstance(null, dittoHeaders)) .withMessageContaining("ShutdownReason") .withMessageContaining("must not be null") .withNoCause(); }
@Test public void toJsonWithoutReason() { final Shutdown shutdown = Shutdown.getInstance(ShutdownNoReason.INSTANCE, dittoHeaders); final JsonObject expectedJson = knownJsonRepresentation.toBuilder() .remove(Shutdown.JsonFields.REASON) .build(); assertThat(shutdown.toJson()).isEqualTo(expectedJson); }