@Test
public void testNotificationsForBundleEvents() throws Exception {

    StateConfig stateConfig = new StateConfig();
    //holders for Notifications captured
    List<Notification> received = new LinkedList<Notification>();
    List<AttributeChangeNotification> attributeChanges = new LinkedList<AttributeChangeNotification>();
    createBundle(stateConfig, received, attributeChanges);
    assertEquals(2, received.size());
    Notification installed = received.get(0);
    assertEquals(1, installed.getSequenceNumber());
    CompositeData installedCompositeData = (CompositeData) installed.getUserData();
    BundleEventData installedData = BundleEventData.from(installedCompositeData);
    assertEquals("bundle", installedData.getBundleSymbolicName());
    assertEquals(9, installedData.getBundleId());
    assertEquals("file:/location", installedData.getLocation());
    assertEquals(BundleEvent.INSTALLED, installedData.getEventType());
    Notification resolved = received.get(1);
    assertEquals(2, resolved.getSequenceNumber());
    CompositeData resolvedCompositeData = (CompositeData) resolved.getUserData();
    BundleEventData resolvedData = BundleEventData.from(resolvedCompositeData);
    assertEquals("bundle", resolvedData.getBundleSymbolicName());
    assertEquals(9, resolvedData.getBundleId());
    assertEquals("file:/location", resolvedData.getLocation());
    assertEquals(BundleEvent.RESOLVED, resolvedData.getEventType());
    assertEquals(1, attributeChanges.size());
    AttributeChangeNotification ac = attributeChanges.get(0);
    assertEquals("BundleIds", ac.getAttributeName());
    assertEquals(0, ((long [])ac.getOldValue()).length);
    assertEquals(1, ((long [])ac.getNewValue()).length);
    assertEquals(9L, ((long [])ac.getNewValue())[0]);
}