MessageCommandAdapter extends AbstractAdapter<MessageCommand<?, ?>> implements ThingMessageAdapter<MessageCommand<?, ?>> { @Override public Adaptable toAdaptable(final MessageCommand<?, ?> t) { return toAdaptable(t, TopicPath.Channel.LIVE); } private  MessageCommandAdapter(final HeaderTranslator headerTranslator); static MessageCommandAdapter of(final HeaderTranslator headerTranslator); @Override Adaptable toAdaptable(final MessageCommand<?, ?> t); @Override boolean isForResponses(); @Override boolean requiresSubject(); @Override Adaptable mapSignalToAdaptable(final MessageCommand<?, ?> command, final TopicPath.Channel channel);  }
@Test public void testMessageToAdaptable() { final String subject = subject(); final String contentType = payload.contentType; final JsonPointer path = path(subject); final TopicPath topicPath = TopicPath.newBuilder(TestConstants.THING_ID) .live() .messages() .subject(subject) .build(); final PayloadBuilder payloadBuilder = Payload.newBuilder(path); if (payload.asJson != null) { payloadBuilder.withValue(payload.asJson); } final Adaptable expectedAdaptable = Adaptable.newBuilder(topicPath) .withPayload(payloadBuilder.build()) .withHeaders(expectedAdaptableHeaders(contentType)) .build(); final MessageHeaders messageHeaders = messageHeaders(subject, contentType); final Message<Object> theMessage = message(messageHeaders, payload.asObject); final DittoHeaders theHeaders = dittoHeaders(); final MessageCommand<?, ?> messageCommand = messageCommand(type, theMessage, theHeaders); final Adaptable actual = underTest.toAdaptable(messageCommand); assertThat(actual).isEqualTo(expectedAdaptable); }