use of org.eclipse.smarthome.core.internal.items.ItemRegistryImpl in project smarthome by eclipse.
the class ItemRegistryImplTest method assertCommandDescriptionServiceGetsRemoved.
@Test
public void assertCommandDescriptionServiceGetsRemoved() {
CommandDescriptionService commandDescriptionService = mock(CommandDescriptionService.class);
((ItemRegistryImpl) itemRegistry).setCommandDescriptionService(commandDescriptionService);
GenericItem item = spy(new SwitchItem("Item1"));
itemProvider.add(item);
verify(item).setCommandDescriptionService(any(CommandDescriptionService.class));
((ItemRegistryImpl) itemRegistry).unsetCommandDescriptionService(commandDescriptionService);
verify(item).setCommandDescriptionService(null);
}
use of org.eclipse.smarthome.core.internal.items.ItemRegistryImpl in project smarthome by eclipse.
the class ItemRegistryImplTest method setUp.
@Before
public void setUp() {
initMocks(this);
ItemFactory coreItemFactory = new CoreItemFactory();
GenericItem cameraItem1 = new SwitchItem(CAMERA_ITEM_NAME1);
GenericItem cameraItem2 = new SwitchItem(CAMERA_ITEM_NAME2);
GenericItem cameraItem3 = new NumberItem(CAMERA_ITEM_NAME3);
GenericItem cameraItem4 = new NumberItem(CAMERA_ITEM_NAME4);
cameraItem1.addTag(CAMERA_TAG);
cameraItem2.addTag(CAMERA_TAG);
cameraItem2.addTag(SENSOR_TAG);
cameraItem3.addTag(CAMERA_TAG);
cameraItem4.addTag(CAMERA_TAG_UPPERCASE);
// setup ManageItemProvider with necessary dependencies:
itemProvider = new ManagedItemProvider() {
{
setStorageService(new VolatileStorageService());
addItemFactory(coreItemFactory);
}
};
itemProvider.add(new SwitchItem(ITEM_NAME));
itemProvider.add(cameraItem1);
itemProvider.add(cameraItem2);
itemProvider.add(cameraItem3);
itemProvider.add(cameraItem4);
// setup ItemRegistryImpl with necessary dependencies:
itemRegistry = new ItemRegistryImpl() {
{
addProvider(itemProvider);
setManagedProvider(itemProvider);
setEventPublisher(ItemRegistryImplTest.this.eventPublisher);
setStateDescriptionService(mock(StateDescriptionService.class));
setUnitProvider(mock(UnitProvider.class));
setItemStateConverter(mock(ItemStateConverter.class));
}
};
}
use of org.eclipse.smarthome.core.internal.items.ItemRegistryImpl in project smarthome by eclipse.
the class ItemRegistryImplTest method assertCommandDescriptionServiceGetsInjected.
@Test
public void assertCommandDescriptionServiceGetsInjected() {
GenericItem item = spy(new SwitchItem("Item1"));
itemProvider.add(item);
verify(item).setCommandDescriptionService(null);
((ItemRegistryImpl) itemRegistry).setCommandDescriptionService(mock(CommandDescriptionService.class));
verify(item).setCommandDescriptionService(any(CommandDescriptionService.class));
}
Aggregations