Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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 <github@maindrain.net>
wborn authored and andrewfg committed Aug 31, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 0ce10e4 commit eb55cb7
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -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.*;

@@ -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;
@@ -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 {
@@ -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);

0 comments on commit eb55cb7

Please sign in to comment.