FeatureManager implements IFeatureManager { @Override public IFeature newFeature(final String name, final IFilesystemTracker tracker) throws FeatureManagementException, InvalidArgumentException { if (null == tracker) { throw new InvalidArgumentException("Tracke should not be null."); } try { return new Feature(name, tracker, this.queue); } catch (InvalidArgumentException e) { throw new FeatureManagementException("Error creating new feature.", e); } } FeatureManager(); @Override IFeature newFeature(final String name, final IFilesystemTracker tracker);  }
@Test(expected = InvalidArgumentException.class) public void Should_constructorThrow_When_filesystemTrackerIsNull() throws Exception { new FeatureManager().newFeature("bug", null); }
@Test(expected = FeatureManagementException.class) public void Should_newFeatureThrow_When_FeatureConstructorThrows() throws Exception { new FeatureManager().newFeature(null, mock(IFilesystemTracker.class)); }
@Test public void Should_createNewFeatures() throws Exception { IFeature feature = new FeatureManager().newFeature("bug", mock(IFilesystemTracker.class)); assertNotNull(feature); assertTrue(feature instanceof Feature); }