@Test void testWithMetaData() { Object payload = new Object(); Map<String, Object> metaDataMap = Collections.singletonMap("key", "value"); MetaData metaData = MetaData.from(metaDataMap); GenericCommandMessage<Object> message = new GenericCommandMessage<>(payload, metaData); GenericCommandMessage<Object> message1 = message.withMetaData(MetaData.emptyInstance()); GenericCommandMessage<Object> message2 = message.withMetaData( MetaData.from(Collections.singletonMap("key", (Object) "otherValue"))); assertEquals(0, message1.getMetaData().size()); assertEquals(1, message2.getMetaData().size()); }
@Override public GenericCommandMessage<T> withMetaData(Map<String, ?> metaData) { return new GenericCommandMessage<>(getDelegate().withMetaData(metaData), commandName); }
GenericCommandMessage extends MessageDecorator<T> implements CommandMessage<T> { @Override public GenericCommandMessage<T> withMetaData(Map<String, ?> metaData) { return new GenericCommandMessage<>(getDelegate().withMetaData(metaData), commandName); } }
GenericCommandMessage extends MessageDecorator<T> implements CommandMessage<T> { @Override public GenericCommandMessage<T> withMetaData(Map<String, ?> metaData) { return new GenericCommandMessage<>(getDelegate().withMetaData(metaData), commandName); } GenericCommandMessage(T payload);  GenericCommandMessage(T payload, Map<String, ?> metaData);  GenericCommandMessage(Message<T> delegate, String commandName); }
GenericCommandMessage extends MessageDecorator<T> implements CommandMessage<T> { @Override public GenericCommandMessage<T> withMetaData(Map<String, ?> metaData) { return new GenericCommandMessage<>(getDelegate().withMetaData(metaData), commandName); } GenericCommandMessage(T payload);  GenericCommandMessage(T payload, Map<String, ?> metaData);  GenericCommandMessage(Message<T> delegate, String commandName); @SuppressWarnings("unchecked") static CommandMessage<C> asCommandMessage(Object command); @Override String getCommandName(); @Override GenericCommandMessage<T> withMetaData(Map<String, ?> metaData); @Override GenericCommandMessage<T> andMetaData(Map<String, ?> metaData); }
GenericCommandMessage extends MessageDecorator<T> implements CommandMessage<T> { @Override public GenericCommandMessage<T> withMetaData(Map<String, ?> metaData) { return new GenericCommandMessage<>(getDelegate().withMetaData(metaData), commandName); } GenericCommandMessage(T payload);  GenericCommandMessage(T payload, Map<String, ?> metaData);  GenericCommandMessage(Message<T> delegate, String commandName); @SuppressWarnings("unchecked") static CommandMessage<C> asCommandMessage(Object command); @Override String getCommandName(); @Override GenericCommandMessage<T> withMetaData(Map<String, ?> metaData); @Override GenericCommandMessage<T> andMetaData(Map<String, ?> metaData);  }