use of org.eclipse.smarthome.core.items.events.ItemUpdatedEvent in project smarthome by eclipse.
the class GroupItemTest method testItemUpdateWithItemRegistry.
@Ignore
@Test
public void testItemUpdateWithItemRegistry() {
GroupItem item = new GroupItem("mySimpleGroupItem");
item.setLabel("firstLabel");
itemRegistry.add(item);
GroupItem updatedItem = (GroupItem) itemRegistry.get("mySimpleGroupItem");
assertNotNull(updatedItem);
events.clear();
updatedItem.setLabel("secondLabel");
itemRegistry.update(updatedItem);
waitForAssert(() -> assertThat(events.size(), is(1)));
List<Event> stateChanges = events.stream().filter(it -> it instanceof ItemUpdatedEvent).collect(Collectors.toList());
assertThat(stateChanges.size(), is(1));
ItemUpdatedEvent change = (ItemUpdatedEvent) stateChanges.get(0);
assertThat(change.getItem().label, is("secondLabel"));
}
Aggregations