void () { String[] SSH_URL_VARIANTS = { "git@github.com", "git@github.com/project.git", "ssh://git@github.com/project.git", "ssh://github.com/project.git", "git@github.com:project.git", "ssh://git@github.com:project.git", "ssh://github.com:project.git", "user@name@github.com:project.git", "git@github.com/company/user/project.git", "git@github.com:company/user/project.git", "git@github.com:3128:user/project.git" }; for (String sshUrl : SSH_URL_VARIANTS) { assertEquals("github.com", URLUtil.parseHostFromSshUrl(sshUrl)); } // sanity checks assertEquals("test", URLUtil.parseHostFromSshUrl("file://test")); assertEquals("test1", URLUtil.parseHostFromSshUrl("test1:test2")); assertEquals("@test", URLUtil.parseHostFromSshUrl("@test")); assertEquals("", URLUtil.parseHostFromSshUrl("test@")); }