ConfigCommand { public RepositoryConfiguration createRepositoryConfiguration() { final RepositoryConfiguration configuration = new RepositoryConfiguration(getName()); BeanUtils.copyProperties(this, configuration); if (AccessMethod.USER == accessMethod) { configuration.setEnableAccessControl(true); configuration.setUserCredentials(Credentials.EMPTY); } else { configuration.setUserCredentials(new Credentials(userName, userPassword)); } if (isCacheUsed()) { configuration.setCacheCredentials(new Credentials(cacheUserName, cacheUserPassword)); } else { configuration.setCacheCredentials(Credentials.EMPTY); } return configuration; }  String getRepositoryUrl(); void setRepositoryUrl(final String repositoryUrl); String getUserName(); void setUserName(final String userName); String getUserPassword(); void setUserPassword(final String userPassword); boolean isCacheUsed(); void setCacheUsed(final boolean useCache); AccessMethod getAccessMethod(); void setAccessMethod(final AccessMethod accessMethod); boolean isZippedDownloadsAllowed(); void setZippedDownloadsAllowed(final boolean zipDownloadsAllowed); String getName(); void setName(final String name); String getCacheUserName(); void setCacheUserName(String cacheUserName); String getCacheUserPassword(); void setCacheUserPassword(String cacheUserPassword); RepositoryConfiguration createRepositoryConfiguration(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testCreateRepositoryConfiguration() { final ConfigCommand command = new ConfigCommand(); command.setName("testrepos"); command.setRepositoryUrl("http: command.setAccessMethod(ConfigCommand.AccessMethod.SHARED); command.setCacheUsed(true); command.setZippedDownloadsAllowed(true); command.setCacheUserName("cache uid"); command.setCacheUserPassword("cache pwd"); command.setUserName("uid"); command.setUserPassword("pwd"); final RepositoryConfiguration configuration = command.createRepositoryConfiguration(); assertEquals("http: assertFalse(configuration.isAccessControlEnabled()); assertTrue(configuration.isCacheUsed()); assertTrue(configuration.isZippedDownloadsAllowed()); assertEquals("uid", configuration.getUserCredentials().getUserName()); assertEquals("pwd", configuration.getUserCredentials().getPassword()); assertEquals("cache uid", configuration.getCacheCredentials().getUserName()); assertEquals("cache pwd", configuration.getCacheCredentials().getPassword()); }