RemoteRepository implements ArtifactRepository { public String getProtocol() { Matcher m = URL_PATTERN.matcher( this.url ); if ( m.matches() ) { return m.group( 1 ); } return ""; } RemoteRepository();  RemoteRepository( RemoteRepository repository );  RemoteRepository( String id, String type, String url ); String getId(); RemoteRepository setId( String id ); String getContentType(); RemoteRepository setContentType( String type ); String getUrl(); RemoteRepository setUrl( String url ); String getProtocol(); String getHost(); RepositoryPolicy getPolicy( boolean snapshot ); RemoteRepository setPolicy( boolean snapshot, RepositoryPolicy policy ); Proxy getProxy(); RemoteRepository setProxy( Proxy proxy ); Authentication getAuthentication(); RemoteRepository setAuthentication( Authentication authentication ); List<RemoteRepository> getMirroredRepositories(); RemoteRepository setMirroredRepositories( List<RemoteRepository> mirroredRepositories ); boolean isRepositoryManager(); RemoteRepository setRepositoryManager( boolean repositoryManager ); @Override String toString(); @Override boolean equals( Object obj ); @Override int hashCode();  }
@Test public void testGetProtocol() { RemoteRepository repo = new RemoteRepository( "id", "type", "" ); assertEquals( "", repo.getProtocol() ); repo = repo.setUrl( "http: assertEquals( "http", repo.getProtocol() ); repo = repo.setUrl( "HTTP: assertEquals( "HTTP", repo.getProtocol() ); repo = repo.setUrl( "dav+http: assertEquals( "dav+http", repo.getProtocol() ); repo = repo.setUrl( "dav:http: assertEquals( "dav:http", repo.getProtocol() ); repo = repo.setUrl( "file:/path" ); assertEquals( "file", repo.getProtocol() ); repo = repo.setUrl( "file:path" ); assertEquals( "file", repo.getProtocol() ); repo = repo.setUrl( "file:C:\\dir" ); assertEquals( "file", repo.getProtocol() ); repo = repo.setUrl( "file:C:/dir" ); assertEquals( "file", repo.getProtocol() ); }