Project implements Serializable, Runnable { void notifyListeners(final ProjectEvent event) { if (projectConfig == null) { throw new IllegalStateException("projectConfig is null"); } for (final Listener listener : projectConfig.getListeners()) { try { listener.handleEvent(event); } catch (CruiseControlException e) { final StringBuilder message = new StringBuilder("exception notifying listener "); message.append(listener.getClass().getName()); message.append(" for project ").append(name); LOG.error(message.toString(), e); } } } Project(); void execute(); void run(); void forceBuildWithTarget(String buildTarget); void forceBuildWithTarget(String buildTarget, Map<String, String> addedProperties); void serializeProject(); void setLabelIncrementer(final LabelIncrementer incrementer); LabelIncrementer getLabelIncrementer(); void setName(final String projectName); String getName(); void setLabel(final String newLabel); String getLabel(); void setLastBuild(final String newLastBuild); void setLastSuccessfulBuild(final String newLastSuccessfulBuild); String getLastBuild(); boolean getBuildForced(); void setBuildForced(boolean forceNewBuildNow); String getLastSuccessfulBuild(); String getLogDir(); long getBuildInterval(); void overrideBuildInterval(final long sleepMillis); boolean isPaused(); void setPaused(final boolean paused); void setBuildAfterFailed(final boolean rebuildEvenWithNoNewModifications); String getStatus(); String getStatusWithQueuePosition(); ProjectState getState(); void setBuildQueue(final BuildQueue buildQueue); String getBuildStartTime(); Log getLog(); boolean isLastBuildSuccessful(); void start(); void stop(); String toString(); void addBuildProgressListener(final BuildProgressListener listener); void addBuildResultListener(final BuildResultListener listener); void setProjectConfig(final ProjectConfig projectConfig); boolean equals(final Object arg0); int hashCode(); void register(final MBeanServer server); ProjectConfig getProjectConfig(); Date getLastBuildDate(); Progress getProgress(); List<String> getLogLabels(); String[] getLogLabelLines(final String logLabel, final int firstLine);  }
@Test public void testNotifyListeners() { MockListener listener = new MockListener(); ProjectConfig.Listeners listeners = new ProjectConfig.Listeners(); listeners.add(listener); projectConfig.add(listeners); project.init(); ProjectEvent event = new ProjectEvent("foo") { }; project.notifyListeners(event); assertTrue(listener.wasNotified()); }