DiscoveryResultImpl implements DiscoveryResult { public void synchronize(@Nullable DiscoveryResult sourceResult) { if (sourceResult != null && thingUID.equals(sourceResult.getThingUID())) { this.properties = sourceResult.getProperties(); this.representationProperty = sourceResult.getRepresentationProperty(); this.label = sourceResult.getLabel(); this.timestamp = new Date().getTime(); this.timeToLive = sourceResult.getTimeToLive(); } } DiscoveryResultImpl(); @Deprecated  DiscoveryResultImpl(@Nullable ThingTypeUID thingTypeUID, ThingUID thingUID, @Nullable ThingUID bridgeUID,
            @Nullable Map<String, Object> properties, @Nullable String representationProperty, @Nullable String label,
            long timeToLive); @Override ThingUID getThingUID(); @Override ThingTypeUID getThingTypeUID(); @Override String getBindingId(); @Override Map<String, Object> getProperties(); @Override @Nullable String getRepresentationProperty(); @Override DiscoveryResultFlag getFlag(); @Override String getLabel(); @Override @Nullable ThingUID getBridgeUID(); void synchronize(@Nullable DiscoveryResult sourceResult); void setFlag(@Nullable DiscoveryResultFlag flag); @Override int hashCode(); @Override boolean equals(@Nullable Object obj); @Override String toString(); @Override long getTimestamp(); @Override long getTimeToLive();  }
@Test public void testSynchronize() { ThingTypeUID thingTypeUID = new ThingTypeUID("bindingId", "thingType"); Map<String, Object> discoveryResultSourceMap = new HashMap<>(); discoveryResultSourceMap.put("ipAddress", "127.0.0.1"); DiscoveryResultImpl discoveryResult = new DiscoveryResultImpl(thingTypeUID, new ThingUID(thingTypeUID, "thingId"), null, discoveryResultSourceMap, "ipAddress", "TARGET", DEFAULT_TTL); discoveryResult.setFlag(DiscoveryResultFlag.IGNORED); Map<String, Object> discoveryResultMap = new HashMap<>(); discoveryResultMap.put("ipAddress", "192.168.178.1"); discoveryResultMap.put("macAddress", "AA:BB:CC:DD:EE:FF"); DiscoveryResultImpl discoveryResultSource = new DiscoveryResultImpl(thingTypeUID, new ThingUID(thingTypeUID, "thingId"), null, discoveryResultMap, "macAddress", "SOURCE", DEFAULT_TTL); discoveryResultSource.setFlag(DiscoveryResultFlag.NEW); discoveryResult.synchronize(discoveryResultSource); assertEquals("192.168.178.1", discoveryResult.getProperties().get("ipAddress")); assertEquals("AA:BB:CC:DD:EE:FF", discoveryResult.getProperties().get("macAddress")); assertEquals("macAddress", discoveryResult.getRepresentationProperty()); assertEquals("SOURCE", discoveryResult.getLabel()); assertEquals(DiscoveryResultFlag.IGNORED, discoveryResult.getFlag()); }