PurgeEntitiesReason implements ShutdownReason { static PurgeEntitiesReason fromJson(final JsonObject jsonObject) { final List<String> entityIdsToPurge = jsonObject.getValueOrThrow(JsonFields.DETAILS).asArray().stream() .map(JsonValue::asString) .collect(Collectors.toList()); return new PurgeEntitiesReason(entityIdsToPurge); } private  PurgeEntitiesReason(final List<String> entityIdsToPurge); static PurgeEntitiesReason of(final List<EntityId> entityIdsToPurge); @Override ShutdownReasonType getType(); @Override boolean isRelevantFor(final Object value); @Override JsonObject toJson(); @Override JsonObject toJson(final JsonSchemaVersion schemaVersion, final Predicate<JsonField> predicate); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }
@Test public void fromJson() { assertThat(PurgeEntitiesReason.fromJson(knownJsonRepresentation)).isEqualTo(underTest); }
@Test public void fromJsonWithoutDetailsCausesException() { final JsonObject shutDownNamespaceReasonWithoutDetails = knownJsonRepresentation.toBuilder() .remove(ShutdownReason.JsonFields.DETAILS) .build(); assertThatExceptionOfType(JsonMissingFieldException.class).isThrownBy( () -> PurgeNamespaceReason.fromJson(shutDownNamespaceReasonWithoutDetails)); }