@Test public void providesAnAntBuilderFactory() { assertThat(registry.getFactory(AntBuilder.class), instanceOf(DefaultAntBuilderFactory.class)); assertThat( registry.getFactory(AntBuilder.class), sameInstance((Object) registry.getFactory(AntBuilder.class))); }
@Test public void providesATemporaryFileProvider() { assertThat( registry.get(TemporaryFileProvider.class), instanceOf(DefaultTemporaryFileProvider.class)); assertThat( registry.get(TemporaryFileProvider.class), sameInstance(registry.get(TemporaryFileProvider.class))); }
@Test public void providesADependencyHandler() { expectDependencyResolutionServicesCreated(); assertThat(registry.get(DependencyHandler.class), sameInstance(dependencyHandler)); assertThat( registry.get(DependencyHandler.class), sameInstance(registry.get(DependencyHandler.class))); }
@Test public void providesAnArtifactHandler() { expectDependencyResolutionServicesCreated(); assertThat(registry.get(ArtifactHandler.class), instanceOf(DefaultArtifactHandler.class)); assertThat( registry.get(ArtifactHandler.class), sameInstance(registry.get(ArtifactHandler.class))); }
@Test public void providesAConfigurationContainer() { expectDependencyResolutionServicesCreated(); assertThat(registry.get(ConfigurationContainer.class), sameInstance(configurationContainer)); assertThat( registry.get(ConfigurationContainer.class), sameInstance(registry.get(ConfigurationContainer.class))); }
@Test public void providesAScriptHandlerAndScriptClassLoaderProvider() { expectScriptClassLoaderProviderCreated(); assertThat(registry.get(ScriptHandler.class), instanceOf(DefaultScriptHandler.class)); assertThat(registry.get(ScriptHandler.class), sameInstance(registry.get(ScriptHandler.class))); assertThat( registry.get(ScriptClassLoaderProvider.class), sameInstance((Object) registry.get(ScriptHandler.class))); }
@Test public void providesAnArtifactPublicationServicesFactory() { expectDependencyResolutionServicesCreated(); assertThat( registry.getFactory(ArtifactPublicationServices.class), sameInstance(publishServicesFactory)); assertThat( registry.getFactory(ArtifactPublicationServices.class), sameInstance(registry.getFactory(ArtifactPublicationServices.class))); }
@Test public void providesAFileOperationsInstance() { context.checking( new Expectations() { { one(project).getTasks(); } }); assertThat(registry.get(FileOperations.class), instanceOf(DefaultFileOperations.class)); assertThat( registry.get(FileOperations.class), sameInstance(registry.get(FileOperations.class))); }
@Test public void providesAPluginContainer() { expectScriptClassLoaderProviderCreated(); context.checking( new Expectations() { { one(pluginRegistry).createChild(with(notNullValue(ClassLoader.class))); } }); assertThat( registry.get(PluginContainer.class), instanceOf(DefaultProjectsPluginContainer.class)); assertThat( registry.get(PluginContainer.class), sameInstance(registry.get(PluginContainer.class))); }
@Test public void providesALoggingManager() { final Factory<LoggingManagerInternal> loggingManagerFactory = context.mock(Factory.class); final LoggingManager loggingManager = context.mock(LoggingManagerInternal.class); context.checking( new Expectations() { { allowing(parent).getFactory(LoggingManagerInternal.class); will(returnValue(loggingManagerFactory)); one(loggingManagerFactory).create(); will(returnValue(loggingManager)); } }); assertThat(registry.get(LoggingManager.class), sameInstance(loggingManager)); assertThat( registry.get(LoggingManager.class), sameInstance(registry.get(LoggingManager.class))); }
@Test public void providesAFileResolver() { assertThat(registry.get(FileResolver.class), instanceOf(BaseDirConverter.class)); assertThat(registry.get(FileResolver.class), sameInstance(registry.get(FileResolver.class))); }
@Test public void providesATaskContainerFactory() { assertThat( registry.getFactory(TaskContainerInternal.class), instanceOf(DefaultTaskContainerFactory.class)); }
@Test public void providesAConvention() { assertThat(registry.get(Convention.class), instanceOf(DefaultConvention.class)); assertThat(registry.get(Convention.class), sameInstance(registry.get(Convention.class))); }
@Test public void createsARegistryForATask() { ServiceRegistryFactory taskRegistry = registry.createFor(context.mock(TaskInternal.class)); assertThat(taskRegistry, instanceOf(TaskInternalServiceRegistry.class)); }