AcknowledgementAdapter implements Adapter<Acknowledgement> { @Override public Acknowledgement fromAdaptable(final Adaptable adaptable) { checkNotNull(adaptable, "adaptable"); return ThingAcknowledgementFactory.newAcknowledgement(getAcknowledgementLabel(adaptable), getThingId(adaptable), getStatusCodeOrThrow(adaptable), adaptable.getDittoHeaders(), getPayloadValueOrNull(adaptable)); } private  AcknowledgementAdapter(final HeaderTranslator headerTranslator); @Override Acknowledgement fromAdaptable(final Adaptable adaptable); @Override Adaptable toAdaptable(final Acknowledgement acknowledgement, final TopicPath.Channel channel); @Override Set<TopicPath.Group> getGroups(); @Override Set<TopicPath.Channel> getChannels(); @Override Set<TopicPath.Criterion> getCriteria(); @Override Set<TopicPath.Action> getActions(); @Override boolean isForResponses(); @Override boolean requiresSubject();  }
@Test public void acknowledgementFromAdaptable() { final DittoHeaders dittoHeaders = DittoHeaders.newBuilder().randomCorrelationId().build(); final JsonValue customAckPayload = JsonValue.of("Custom Ack payload"); final HttpStatusCode status = HttpStatusCode.CREATED; final Adaptable adaptable = Adaptable.newBuilder(topicPathMyCustomAck) .withHeaders(dittoHeaders) .withPayload(Payload.newBuilder(JsonPointer.empty()) .withValue(customAckPayload) .withStatus(status) .build()) .build(); final Acknowledgement expected = ThingAcknowledgementFactory.newAcknowledgement(KNOWN_CUSTOM_LABEL, TestConstants.THING_ID, status, dittoHeaders, customAckPayload); final Acknowledgement actual = underTest.fromAdaptable(adaptable); assertWithExternalHeadersThat(actual).isEqualTo(expected); }