@Test
  public void testPropertyMonitors() throws Exception {

    IPropertyMonitorRule ruleMock1 = createMock(IPropertyMonitorRule.class);
    IPropertyMonitorRule ruleMock2 = createMock(IPropertyMonitorRule.class);

    expect(ruleMock1.isActive(anyObject(), anyObject())).andReturn(true).once();
    expect(ruleMock2.isActive(anyObject(), anyObject())).andReturn(true).once();
    expect(ruleMock1.isActive(anyObject(), anyObject())).andReturn(true).once();

    replay(ruleMock1, ruleMock2);

    PropertyMonitorStub monitor1 = new PropertyMonitorStub();
    PropertyMonitorStub monitor2 = new PropertyMonitorStub();

    Property property = getFloatProperty();
    property.addMonitor(monitor1, ruleMock1);
    property.addMonitor(monitor2, ruleMock2);
    property.notifyMonitors(null);

    property.removeMonitor(monitor2);
    property.notifyMonitors(null);

    verify(ruleMock1, ruleMock2);
    assertEquals(2, monitor1.getPropertyChangedInvokationCounter());
    assertEquals(1, monitor2.getPropertyChangedInvokationCounter());
  }
  /**
   * Scenario: property value is object that implements IChangesNotifier interface. It changes its
   * internal state and informs monitors about it. The property itself should inform its monitors
   * about change.
   *
   * @throws Exception
   */
  @Test
  public void testChangesNotifierProperty() throws Exception {
    PropertyMonitorStub monitor = new PropertyMonitorStub();

    Property property = _propertiesObject.getProperty("changesNotifierProperty");
    property.addMonitor(monitor, new DefaultPropertyMonitorRule());

    ChangesNotifierStub notifier = (ChangesNotifierStub) property.getValue();
    notifier.notifyMonitorsAboutChange();

    assertEquals(1, monitor.getPropertyChangedInvokationCounter());
  }