@Test
 public void testCreateRepWithCredentials() {
   String plainUrl = "http://*****:*****@some.repo.url/somepath";
   RemoteRepository repository = createRemoteRepository(plainUrl);
   assertNotNull(repository);
   assertNotNull(repository.getId());
   assertNotNull(repository.getAuthentication());
   assertEquals("user", repository.getAuthentication().getUsername());
   assertEquals("password", repository.getAuthentication().getPassword());
   assertEquals("http://some.repo.url/somepath", repository.getUrl());
 }
 @Test
 public void testCreateSimpleRepo() {
   String plainUrl = "http://some.repo.url/somepath";
   RemoteRepository repository = createRemoteRepository(plainUrl);
   assertNotNull(repository);
   assertNotNull(repository.getId());
   assertNull(repository.getAuthentication());
 }
  private Realm getRealm(RemoteRepository repository) {
    Realm realm = null;

    Authentication a = repository.getAuthentication();
    if (a != null && a.getUsername() != null) {
      realm =
          new Realm.RealmBuilder()
              .setPrincipal(a.getUsername())
              .setPassword(a.getPassword())
              .setUsePreemptiveAuth(false)
              .build();
    }

    return realm;
  }