Plugin extends Extension { @Override public Path getBasePath() { if (url.getHost().equals("github.com") || endsWithVersion.matcher(getBaseName(getUrlFileName())).matches()) { if (versionBeginsWithV.matcher(version).matches()) { return Paths.get(id + "-" + version.substring(1)); } return Paths.get(id + "-" + version); } return Paths.get(id); } @JsonCreator  Plugin(@JsonProperty("id") String id,
                  @JsonProperty("name") String name,
                  @JsonProperty("version") String version,
                  @JsonProperty("description") String description,
                  @JsonProperty("url") URL url);   Plugin(URL url); @Override void delete(Path pluginsDirectory); @Override void install(File pluginFile, Path pluginsDir); @Override Path getBasePath();  }
@Test public void test_get_base_directory() throws Exception { Plugin plugin = new Plugin("id", "name", "1.0.0", "", new URL("https: assertThat(plugin.getBasePath().toString()).isEqualTo("id"); }
@Test public void test_get_base_directory_with_version() throws Exception { Plugin plugin = new Plugin("id", "name", "1.0.0", "", new URL("https: assertThat(plugin.getBasePath().toString()).isEqualTo("id-1.0.0"); }
@Test public void test_get_base_directory_with_version_starting_with_v() throws Exception { Plugin plugin = new Plugin("id", "name", "v1.0.0", "", new URL("https: assertThat(plugin.getBasePath().toString()).isEqualTo("id-1.0.0"); }
@Test public void test_get_base_directory_with_github_version_starting_with_v() throws Exception { assertThat(new Plugin("id", "name", "v1.2.3", "", new URL("https: .getBasePath().toString()) .isEqualTo("id-1.2.3"); }
@Test public void test_get_base_directory_with_github_version() throws Exception { assertThat(new Plugin("id", "name", "1.2.3", "", new URL("https: .getBasePath().toString()) .isEqualTo("id-1.2.3"); }