Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/io/mapsmessaging/api/MessageBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public MessageBuilder(Message previousMessage) {
expiry = (previousMessage.getExpiry() - System.currentTimeMillis());
creation = previousMessage.getCreation();
contentType = previousMessage.getContentType();
responseTopic = previousMessage.getResponseTopic();
if(previousMessage.getCorrelationData() != null && !previousMessage.isCorrelationDataByteArray()) {
correlationData = new String(previousMessage.getCorrelationData());
}
Expand Down
11 changes: 11 additions & 0 deletions src/test/java/io/mapsmessaging/api/MessageBuilderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ void copyConstructor_preservesMessageFields_andIsolatesMaps() {
Message original = new MessageBuilder()
.setCreation(creation)
.setSchemaId("schema-id")
.setResponseTopic("reply/topic")
.setMeta(meta)
.setDataMap(dataMap)
.build();
Expand All @@ -145,6 +146,7 @@ void copyConstructor_preservesMessageFields_andIsolatesMaps() {

Assertions.assertEquals(creation, copy.getCreation());
Assertions.assertEquals("schema-id", copy.getSchemaId());
Assertions.assertEquals("reply/topic", copy.getResponseTopic());
Assertions.assertNotSame(original.getMeta(), copy.getMeta());
Assertions.assertNotSame(original.getDataMap(), copy.getDataMap());

Expand All @@ -153,4 +155,13 @@ void copyConstructor_preservesMessageFields_andIsolatesMaps() {
Assertions.assertFalse(original.getMeta().containsKey("copy-meta"));
Assertions.assertFalse(original.getDataMap().containsKey("copy-data"));
}

@Test
void copyConstructor_preservesNullResponseTopic() {
Message original = new MessageBuilder().build();

Message copy = new MessageBuilder(original).build();

Assertions.assertNull(copy.getResponseTopic());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ void applyOverrides_mergesMeta_andDataMap_creatingMapsWhenNull() {

Assertions.assertEquals("x", updated.getDataMap().get("d1").getData());
Assertions.assertEquals(42L, updated.getDataMap().get("d2").getData());
Assertions.assertEquals("resp/topic", updated.getResponseTopic());
Assertions.assertFalse(message.getMeta().containsKey("m2"));
Assertions.assertFalse(message.getDataMap().containsKey("d2"));
}
Expand Down
Loading