GithubBasePlugin implements Plugin<Project> { @Override public void apply(Project project) { this.project = project; if (project != project.getRootProject()) { project.getLogger().warn("This plugin should only be applied to the root project"); } githubExtension = project.getExtensions().create("github", GithubExtension.class); githubExtension.getSlug().convention(project.provider(() -> GitUtils.findSlug(project))); githubExtension.getTravis().convention(project.provider(this::isTravis)); githubExtension.getTag().convention(project.provider(() -> GitUtils.getTag(project))); githubExtension.getUsername().convention(project.provider(() -> GitUtils.findGithubUsername(project))); githubExtension.getToken().convention(project.provider(() -> GitUtils.findGithubToken(project))); OkHttpPlugin okHttpPlugin = project.getPlugins().apply(OkHttpPlugin.class); githubClient = new GithubClient(githubExtension, okHttpPlugin.getOkHttpClient()); }  @Override void apply(Project project);  }
@Test void apply() { GithubBasePlugin basePlugin = project.getPlugins().apply(GithubBasePlugin.class); GithubExtension githubExtension = basePlugin.getGithubExtension(); assertThat(githubExtension.getSlug().get()).isEqualTo("freefair/gradle-plugins"); }