Skip to content

Commit

Permalink
Review: Ensure dittoHeadersForMerge of UpdateTwinWithLiveResonseMessa…
Browse files Browse the repository at this point in the history
…geMapper is non-null; add assertion that the channel header is not set after mapping.

Signed-off-by: Yufei Cai <yufei.cai@bosch.io>
  • Loading branch information
yufei-cai committed Nov 25, 2021
1 parent 977b95e commit de171ee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,10 @@ public class UpdateTwinWithLiveResponseMessageMapper extends AbstractMessageMapp

static final String CORRELATION_ID_SUFFIX = "-merge-into-twin";

private DittoHeaders dittoHeadersForMerge;
private DittoHeaders dittoHeadersForMerge = DEFAULT_DITTO_HEADERS_FOR_MERGE;

@Override
public void doConfigure(final MappingConfig mappingConfig, final MessageMapperConfiguration configuration) {
dittoHeadersForMerge = DEFAULT_DITTO_HEADERS_FOR_MERGE;
configuration.findProperty(DITTO_HEADERS_FOR_MERGE, JsonValue::isObject, JsonValue::asObject)
.ifPresent(
configuredHeaders -> dittoHeadersForMerge = DittoHeaders.newBuilder(configuredHeaders).build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ public void mapRetrieveThingLiveResponseToExpectedMergeThingMappingResult() {
.build());
assertThat(mergeThing.getDittoHeaders().getCorrelationId())
.contains(correlationId + UpdateTwinWithLiveResponseMessageMapper.CORRELATION_ID_SUFFIX);
assertThat(mergeThing.getDittoHeaders().getChannel()).isEmpty();
}

@Test
Expand Down

0 comments on commit de171ee

Please sign in to comment.