ImmutableMessageHeaders extends AbstractDittoHeaders implements MessageHeaders { @Override public Optional<OffsetDateTime> getTimestamp() { return getStringForDefinition(MessageHeaderDefinition.TIMESTAMP).map(OffsetDateTime::parse); } 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 getTimestampReturnsExpected() { final MessageHeaders underTest = MessageHeadersBuilder.newInstance(DIRECTION, THING_ID, SUBJECT) .timestamp(TIMESTAMP) .build(); assertThat(underTest.getTimestamp()).contains(OffsetDateTime.parse(TIMESTAMP)); }