Repositories { Repository parse(@Nonnull String url) throws UnknownScmUrlException { final String lowerCaseUrl = url.toLowerCase(); final Matcher matcher = pattern.matcher(lowerCaseUrl); if (matcher.matches()) { return new Repository( matcher.group("host"), matcher.group("owner"), matcher.group("name")); } else { throw new UnknownScmUrlException(url); } } Repositories(ScmRepositoryPluginProperties properties);   }
@Test public void testParse() throws Exception { Repository parsed = null; UnknownScmUrlException e = null; try { parsed = repositories.parse(url); } catch (UnknownScmUrlException ex) { e = ex; } if (expectedRepository == null) { if (e == null) { failBecauseExceptionWasNotThrown(UnknownScmUrlException.class); } } else { assertThat(parsed).isEqualTo(expectedRepository); } }