ImmutableMessageHeaders extends AbstractDittoHeaders implements MessageHeaders { @Override public Optional<HttpStatusCode> getStatusCode() { return getStringForDefinition(MessageHeaderDefinition.STATUS_CODE) .map(Integer::parseInt) .flatMap(HttpStatusCode::forInt); } 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 getStatusCodeReturnsExpected() { final MessageHeaders underTest = MessageHeadersBuilder.newInstance(DIRECTION, THING_ID, SUBJECT) .statusCode(STATUS_CODE) .build(); assertThat(underTest.getStatusCode()).contains(STATUS_CODE); }