PurgeEntities extends CommonCommand<PurgeEntities> implements WithEntityType { public static PurgeEntities fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new CommandJsonDeserializer<PurgeEntities>(TYPE, jsonObject).deserialize(() -> { final EntityType entityType = EntityType.of(jsonObject.getValueOrThrow(JsonFields.ENTITY_TYPE)); final List<EntityId> entityIds = jsonObject.getValueOrThrow(JsonFields.ENTITY_IDS).stream() .map(JsonValue::asString) .map(DefaultEntityId::of) .collect(Collectors.toList()); return of(entityType, entityIds, dittoHeaders); }); } private  PurgeEntities(final EntityType entityType, final Collection<? extends EntityId> entityIds,
            final DittoHeaders dittoHeaders); static PurgeEntities of(final EntityType entityType, final Collection<? extends EntityId> entityIds,
            final DittoHeaders dittoHeaders); static PurgeEntities fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); static String getTopic(final EntityType entityType); @Override EntityType getEntityType(); List<EntityId> getEntityIds(); @Override PurgeEntities setDittoHeaders(final DittoHeaders dittoHeaders); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); static final String TYPE; }
@Test public void fromJsonReturnsExpected() { final PurgeEntities commandFromJson = PurgeEntities.fromJson(KNOWN_JSON, HEADERS); assertThat(commandFromJson).isEqualTo(underTest); }