@Test
public void shouldReceivePropertyAddedEventWhenRegisteredToReceiveEventsBasedUponNodeTypeName() throws Exception {
String[] nodeTypeNames = {"mode:root"};
SimpleListener listener = addListener(1, ALL_EVENTS, null, true, null, nodeTypeNames, false)
.withExpectedNodePrimaryType("mode:root");
this.session.getRootNode().setProperty("fooProp", new String[]{"foo", "bar"});
save();
listener.waitForEvents();
removeListener(listener);
checkResults(listener);
String propPath = "/fooProp";
Event propertyAddedEvent = listener.getEvents().get(0);
assertTrue("Path for added property is wrong: actual=" + propertyAddedEvent.getPath() + ", expected=" + propPath,
containsPath(listener, propPath));
assertTrue(propertyAddedEvent instanceof PropertyEvent);
PropertyEvent propertyEvent = (PropertyEvent) propertyAddedEvent;
assertEquals("foo", propertyEvent.getCurrentValue());
assertEquals(2, propertyEvent.getCurrentValues().size());
assertEquals(Arrays.asList("foo", "bar"), propertyEvent.getCurrentValues());
assertTrue(propertyEvent.isMultiValue());
assertFalse(propertyEvent.wasMultiValue());
assertNull(propertyEvent.getPreviousValue());
assertNull(propertyEvent.getPreviousValues());
}