ImmutableMessagePath implements MessagePath { @Override public boolean isEmpty() { return jsonPointer.isEmpty(); } private  ImmutableMessagePath(final JsonPointer jsonPointer); static MessagePath of(final JsonPointer jsonPointer); @Override Optional<String> getFeatureId(); @Override Optional<MessageDirection> getDirection(); @Override JsonPointer addLeaf(final JsonKey key); @Override JsonPointer append(final JsonPointer pointer); @Override int getLevelCount(); @Override boolean isEmpty(); @Override Optional<JsonKey> get(final int level); @Override Optional<JsonKey> getRoot(); @Override Optional<JsonKey> getLeaf(); @Override JsonPointer cutLeaf(); @Override JsonPointer nextLevel(); @Override Optional<JsonPointer> getSubPointer(final int level); @Override Optional<JsonPointer> getPrefixPointer(final int level); @Override JsonFieldSelector toFieldSelector(); @Override int length(); @Override char charAt(final int index); @Override CharSequence subSequence(final int start, final int end); @Override Iterator<JsonKey> iterator(); @Override boolean equals(@Nullable final Object o); @Override int hashCode(); @Override String toString();  }
@Test public void parseDirection() { assertDirection("/outbox/message/ask").contains(FROM); assertDirection("/attributes/hello").isEmpty(); assertDirection("/features/water-tank/properties/temperature").isEmpty(); assertDirection("/features/water-tank/inbox/messages/heatUp").contains(TO); }
@Test public void parseFeatureId() { assertFeatureId("/outbox/message/ask").isEmpty(); assertFeatureId("/attributes/hello").isEmpty(); assertFeatureId("/features/water-tank/properties/temperature").contains("water-tank"); assertFeatureId("features/water-tank/inbox/messages/heatUp").contains("water-tank"); }