protected IFormComponent newField(String displayName, String clientId) {
    IFormComponent field = newMock(IFormComponent.class);
    checkOrder(field, false);

    expect(field.getClientId()).andReturn(clientId).anyTimes();
    expect(field.getDisplayName()).andReturn(displayName);

    return field;
  }
  public void testCreatesProjectMonitorsForLoadedWorkspace() throws CoreException {
    TestHaskellProject prj = new TestHaskellProject("myproject", getCorePrefs());

    IProjectChangeMonitorFactory factory = createMock(IProjectChangeMonitorFactory.class);
    expect(factory.createProjectChangeMonitor(prj.getPlatformProject()))
        .andReturn(createNiceMock(IResourceChangeListener.class));
    expect(factory.createProjectChangeMonitor((IProject) anyObject()))
        .andReturn(createNiceMock(IResourceChangeListener.class))
        .atLeastOnce(); // projects might already exist in the workspace
    checkOrder(factory, false);
    replay(factory);

    WorkspaceChangeMonitor mon = new WorkspaceChangeMonitor(factory);
    mon.observeChangesOn(getWorkspace());

    getWorkspace().removeResourceChangeListener(mon);

    verify(factory);
  }
 /**
  * Switches order checking of the given mock object (more exactly: the control of the mock object)
  * the on and off. For details, see the EasyMock documentation.
  *
  * @param mock the mock object.
  * @param state <code>true</code> switches order checking on, <code>false</code> switches it off.
  */
 protected final void checkOrder(Object mock, boolean state) {
   EasyMock.checkOrder(mock, state);
 }