@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());
  }
 @Test
 public void testGetMetaProperty() throws PropertyException {
   Property property = getFloatProperty();
   MetaProperty metaProperty = property.getMetaProperty();
   assertTrue(float.class.equals(metaProperty.getPropertyClass()));
   assertTrue(metaProperty.isMonitorable());
   assertTrue(metaProperty.isWriteable());
 }
 @Test
 public void testReadOnlyProperty() throws PropertyException {
   Property property = getReadonlyIntProperty();
   try {
     property.setValue(1);
     fail();
   } catch (InvalidPropertyOperationException ex) {
   }
 }
 @Test
 public void testGetSetValue() throws InvalidPropertyOperationException, PropertyException {
   component.setIntProperty(0);
   Property property = getIntProperty();
   assertEquals(0, property.getValue());
   property.setValue(1);
   assertEquals(1, property.getValue());
   assertEquals(1, component.getIntProperty());
 }
  /**
   * 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());
  }