ImmutableMessageHeaders extends AbstractDittoHeaders implements MessageHeaders { @Override public String getSubject() { final HeaderDefinition definition = MessageHeaderDefinition.SUBJECT; return getStringForDefinition(definition).orElseThrow(() -> newIllegalStateException(definition)); } 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 getSubjectReturnsExpected() { final MessageHeaders underTest = MessageHeadersBuilder.newInstance(DIRECTION, THING_ID, SUBJECT).build(); assertThat(underTest.getSubject()).isEqualTo(SUBJECT); }