Skip to content

Commit

Permalink
[wemo] Fix InboxFilterCriteria deprecation (openhab#7329)
Browse files Browse the repository at this point in the history
Related to openhab/openhab-core#1408

Signed-off-by: Wouter Born <[email protected]>
Signed-off-by: Eugen Freiter <[email protected]>
  • Loading branch information
wborn authored and Eugen Freiter committed Apr 27, 2020
1 parent 6363546 commit d514388
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
package org.openhab.binding.wemo.internal.discovery.test;

import static org.eclipse.smarthome.config.discovery.inbox.InboxPredicates.forThingUID;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

Expand All @@ -21,9 +22,9 @@
import java.util.Collection;
import java.util.List;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.smarthome.config.discovery.DiscoveryResult;
import org.eclipse.smarthome.config.discovery.inbox.Inbox;
import org.eclipse.smarthome.config.discovery.inbox.InboxFilterCriteria;
import org.eclipse.smarthome.core.thing.Thing;
import org.eclipse.smarthome.core.thing.ThingTypeUID;
import org.eclipse.smarthome.core.thing.ThingUID;
Expand All @@ -42,13 +43,14 @@
* @author Svilen Valkanov - Initial contribution
* @author Stefan Triller - Ported Tests from Groovy to Java
*/
@NonNullByDefault
public class WemoDiscoveryOSGiTest extends GenericWemoOSGiTest {

// UpnP service information
private final String SERVICE_ID = "basicevent";
private final String SERVICE_NUMBER = "1";
private static final String SERVICE_ID = "basicevent";
private static final String SERVICE_NUMBER = "1";

private Inbox inbox;
private @NonNullByDefault({}) Inbox inbox;

@Before
public void setUp() throws IOException {
Expand All @@ -75,19 +77,14 @@ public void assertSupportedThingIsDiscovered()
waitForAssert(() -> {
Collection<Device> devices = mockUpnpService.getRegistry().getDevices();
assertThat(devices.size(), is(1));
Device device = null;
for (Device d : devices) {
device = d;
break;
}
Device device = devices.iterator().next();
assertThat(device.getDetails().getModelDetails().getModelName(), is(model));
});

ThingUID thingUID = new ThingUID(thingType, DEVICE_UDN);

waitForAssert(() -> {
List<DiscoveryResult> results = inbox.get(new InboxFilterCriteria(thingUID, null));
assertFalse(results.isEmpty());
assertTrue(inbox.stream().anyMatch(forThingUID(thingUID)));
});

inbox.approve(thingUID, DEVICE_FRIENDLY_NAME);
Expand Down

0 comments on commit d514388

Please sign in to comment.