@Test void testToString() { String actual = new GenericDomainEventMessage<>("AggregateType", "id1", 1, "MyPayload").andMetaData(MetaData.with("key", "value").and("key2", 13)).toString(); assertTrue(actual.startsWith("GenericDomainEventMessage{payload={MyPayload}, metadata={"), "Wrong output: " + actual); assertTrue(actual.contains("'key'->'value'"), "Wrong output: " + actual); assertTrue(actual.contains("'key2'->'13'"), "Wrong output: " + actual); assertTrue(actual.contains("', timestamp='"), "Wrong output: " + actual); assertTrue(actual.contains("', aggregateIdentifier='id1'"), "Wrong output: " + actual); assertTrue(actual.contains("', aggregateType='AggregateType'"), "Wrong output: " + actual); assertTrue(actual.contains("', sequenceNumber=1"), "Wrong output: " + actual); assertTrue(actual.endsWith("}"), "Wrong output: " + actual); }
@Override public GenericDomainEventMessage<T> andMetaData(Map<String, ?> metaData) { if (metaData == null || metaData.isEmpty() || getMetaData().equals(metaData)) { return this; } return new GenericDomainEventMessage<>(type, aggregateIdentifier, sequenceNumber, getDelegate().andMetaData(metaData), getTimestamp()); }
GenericDomainEventMessage extends GenericEventMessage<T> implements DomainEventMessage<T> { @Override public GenericDomainEventMessage<T> andMetaData(Map<String, ?> metaData) { if (metaData == null || metaData.isEmpty() || getMetaData().equals(metaData)) { return this; } return new GenericDomainEventMessage<>(type, aggregateIdentifier, sequenceNumber, getDelegate().andMetaData(metaData), getTimestamp()); } }
GenericDomainEventMessage extends GenericEventMessage<T> implements DomainEventMessage<T> { @Override public GenericDomainEventMessage<T> andMetaData(Map<String, ?> metaData) { if (metaData == null || metaData.isEmpty() || getMetaData().equals(metaData)) { return this; } return new GenericDomainEventMessage<>(type, aggregateIdentifier, sequenceNumber, getDelegate().andMetaData(metaData), getTimestamp()); } GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber, T payload);  GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber, T payload,
                                     Map<String, ?> metaData);  GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber, T payload,
                                     Map<String, ?> metaData, String messageIdentifier, Instant timestamp);  GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber, Message<T> delegate,
                                     Supplier<Instant> timestamp);  GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber,
                                     Message<T> delegate, Instant timestamp); }
GenericDomainEventMessage extends GenericEventMessage<T> implements DomainEventMessage<T> { @Override public GenericDomainEventMessage<T> andMetaData(Map<String, ?> metaData) { if (metaData == null || metaData.isEmpty() || getMetaData().equals(metaData)) { return this; } return new GenericDomainEventMessage<>(type, aggregateIdentifier, sequenceNumber, getDelegate().andMetaData(metaData), getTimestamp()); } GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber, T payload);  GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber, T payload,
                                     Map<String, ?> metaData);  GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber, T payload,
                                     Map<String, ?> metaData, String messageIdentifier, Instant timestamp);  GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber, Message<T> delegate,
                                     Supplier<Instant> timestamp);  GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber,
                                     Message<T> delegate, Instant timestamp); @Override String getType(); @Override String getAggregateIdentifier(); @Override long getSequenceNumber(); @Override GenericDomainEventMessage<T> withMetaData(Map<String, ?> metaData); @Override GenericDomainEventMessage<T> andMetaData(Map<String, ?> metaData); }
GenericDomainEventMessage extends GenericEventMessage<T> implements DomainEventMessage<T> { @Override public GenericDomainEventMessage<T> andMetaData(Map<String, ?> metaData) { if (metaData == null || metaData.isEmpty() || getMetaData().equals(metaData)) { return this; } return new GenericDomainEventMessage<>(type, aggregateIdentifier, sequenceNumber, getDelegate().andMetaData(metaData), getTimestamp()); } GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber, T payload);  GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber, T payload,
                                     Map<String, ?> metaData);  GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber, T payload,
                                     Map<String, ?> metaData, String messageIdentifier, Instant timestamp);  GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber, Message<T> delegate,
                                     Supplier<Instant> timestamp);  GenericDomainEventMessage(String type, String aggregateIdentifier, long sequenceNumber,
                                     Message<T> delegate, Instant timestamp); @Override String getType(); @Override String getAggregateIdentifier(); @Override long getSequenceNumber(); @Override GenericDomainEventMessage<T> withMetaData(Map<String, ?> metaData); @Override GenericDomainEventMessage<T> andMetaData(Map<String, ?> metaData);  }