ImmutableMessageHeaders extends AbstractDittoHeaders implements MessageHeaders { @Override public ThingId getThingEntityId() { final String thingId = getStringForDefinition(MessageHeaderDefinition.THING_ID) .orElseThrow(() -> newIllegalStateException(MessageHeaderDefinition.THING_ID)); return ThingId.of(thingId); } private  ImmutableMessageHeaders(final Map<String, String> theDittoHeaders); @Override MessageDirection getDirection(); @Override String getSubject(); @Override ThingId getThingEntityId(); @Override Optional<String> getFeatureId(); @Override Optional<OffsetDateTime> getTimestamp(); @Override Optional<HttpStatusCode> getStatusCode(); @Override String toString();  }
@Test public void getThingIdReturnsExpected() { final MessageHeaders underTest = MessageHeadersBuilder.newInstance(DIRECTION, THING_ID, SUBJECT).build(); assertThat((CharSequence) underTest.getThingEntityId()).isEqualTo(THING_ID); }