@Test
public void testDispose() {

    TestItem item = new TestItem("test");
    item.setEventPublisher(mock(EventPublisher.class));
    item.setItemStateConverter(mock(ItemStateConverter.class));
    item.setStateDescriptionService(null);
    item.setUnitProvider(mock(UnitProvider.class));
    item.addStateChangeListener(mock(StateChangeListener.class));
    item.dispose();
    assertNull(item.eventPublisher);
    assertNull(item.itemStateConverter);
    // can not be tested as stateDescriptionProviders is private in GenericItem
    // assertThat(item.stateDescriptionProviders, is(nullValue()));
    assertNull(item.unitProvider);
    assertEquals(0, item.listeners.size());
}