SiteCreator { static String retrieveVersion(String repositoryUrl) { int offset = 0; if (repositoryUrl.endsWith("/")) { offset = 1; } String version = repositoryUrl.substring(0, repositoryUrl.length() - offset); final int lastSlash = version.lastIndexOf("/"); version = version.substring(lastSlash + 1, version.length()); return version; } SiteCreator(); static void main(String[] args);  }
@Test public void testRetrieveVersion() throws MalformedURLException { String repoUrl = "http: assertEquals( "4.7", SiteCreator.retrieveVersion( repoUrl ) ); repoUrl = "http: assertEquals( "4.6", SiteCreator.retrieveVersion( repoUrl ) ); repoUrl = "http: assertEquals( "4.6", SiteCreator.retrieveVersion( repoUrl ) ); }