GaugePlugin implements Plugin<Project> { @Override public void apply(Project project) { project.getExtensions().create(GAUGE, GaugeExtension.class); project.getTasks().create(GAUGE, GaugeTask.class); }  @Override void apply(Project project);  }
@Test public void pluginShouldBeAddedOnApply() { project.getPluginManager().apply(GAUGE); assertTrue(project.getPlugins().getPlugin(GAUGE) instanceof GaugePlugin); assertFalse(project.getPlugins().getPlugin(GAUGE) instanceof JavaPlugin); }
@Test public void taskShouldBeAddedOnApply() { project.getPluginManager().apply(GAUGE); TaskContainer tasks = project.getTasks(); assertEquals(1, tasks.size()); SortedMap<String, Task> tasksMap = tasks.getAsMap(); Task gauge = tasksMap.get(GAUGE); assertTrue(gauge instanceof GaugeTask); }