Feature implements IFeature { @Override public void listen() throws FeatureManagementException { if (0 == expectedFileNames.size()) { throw new FeatureManagementException("No files defined for this feature."); } synchronized (this.lock) { if (this.isListening) { throw new FeatureManagementException("listen() called twice."); } this.filesystemTracker.addFileHandler(this.fileHandleAction); this.isListening = true; } } Feature(final String name, final IFilesystemTracker filesystemTracker, final BlockingQueue<ExecutionPair> queue); @Override void requireFile(final String fileName); @Override void whenPresent(final IAction<Collection<IPath>> action); @Override void listen(); @Override String getName();  }
@Test(expected = FeatureManagementException.class) public void Should_listenThrow_When_NoFilesSpecified() throws Exception { Feature feature = new Feature("bug", filesystemTrackerMock, queue); feature.listen(); }