EnrichedThingDTOMapper extends ThingDTOMapper { public static EnrichedThingDTO map(Thing thing, ThingStatusInfo thingStatusInfo, FirmwareStatusDTO firmwareStatus, Map<String, Set<String>> linkedItemsMap, boolean editable) { ThingDTO thingDTO = ThingDTOMapper.map(thing); List<ChannelDTO> channels = new ArrayList<>(); for (ChannelDTO channel : thingDTO.channels) { Set<String> linkedItems = linkedItemsMap != null ? linkedItemsMap.get(channel.id) : Collections.emptySet(); channels.add(new EnrichedChannelDTO(channel, linkedItems)); } return new EnrichedThingDTO(thingDTO, channels, thingStatusInfo, firmwareStatus, editable); }  static EnrichedThingDTO map(Thing thing, ThingStatusInfo thingStatusInfo, FirmwareStatusDTO firmwareStatus,
            Map<String, Set<String>> linkedItemsMap, boolean editable);  }
@Test public void shouldMapEnrichedThingDTO() { when(linkedItemsMap.get("1")).thenReturn(Stream.of("linkedItem1", "linkedItem2").collect(Collectors.toSet())); EnrichedThingDTO enrichedThingDTO = EnrichedThingDTOMapper.map(thing, thingStatusInfo, firmwareStatus, linkedItemsMap, true); assertThat(enrichedThingDTO.editable, is(true)); assertThat(enrichedThingDTO.firmwareStatus, is(equalTo(firmwareStatus))); assertThat(enrichedThingDTO.statusInfo, is(equalTo(thingStatusInfo))); assertThat(enrichedThingDTO.thingTypeUID, is(equalTo(thing.getThingTypeUID().getAsString()))); assertThat(enrichedThingDTO.label, is(equalTo(THING_LABEL))); assertThat(enrichedThingDTO.bridgeUID, is(CoreMatchers.nullValue())); assertChannels(enrichedThingDTO); assertThat(enrichedThingDTO.configuration.values(), is(empty())); assertThat(enrichedThingDTO.properties, is(equalTo(properties))); assertThat(enrichedThingDTO.location, is(equalTo(LOCATION))); }