@Test(dataProvider = "PopulateCredentialsData") public void testPopulateCredentials(CredentialsBean credentials, String username, String password, CredentialsBean expectedCredentials) { CredentialsBean generated = CredentialsHelper.populateCredentials(credentials, username, password); assertEquals(generated.getUsername(), expectedCredentials.getUsername(), "Unexpected username"); assertEquals(generated.getPassword(), expectedCredentials.getPassword(), "Unexpected password"); }
static CredentialsBean populateCredentials(CredentialsBean credentials, String username, String password) { if (credentials == null || credentials.isEmpty()) { return new CredentialsBean(username, password); } if (StringUtils.isNotBlank(credentials.getUsername())) { username = credentials.getUsername(); } if (StringUtils.isNotBlank(credentials.getPassword())) { password = credentials.getPassword(); } return new CredentialsBean(username, password); }
CredentialsHelper { static CredentialsBean populateCredentials(CredentialsBean credentials, String username, String password) { if (credentials == null || credentials.isEmpty()) { return new CredentialsBean(username, password); } if (StringUtils.isNotBlank(credentials.getUsername())) { username = credentials.getUsername(); } if (StringUtils.isNotBlank(credentials.getPassword())) { password = credentials.getPassword(); } return new CredentialsBean(username, password); } }
CredentialsHelper { static CredentialsBean populateCredentials(CredentialsBean credentials, String username, String password) { if (credentials == null || credentials.isEmpty()) { return new CredentialsBean(username, password); } if (StringUtils.isNotBlank(credentials.getUsername())) { username = credentials.getUsername(); } if (StringUtils.isNotBlank(credentials.getPassword())) { password = credentials.getPassword(); } return new CredentialsBean(username, password); } private  CredentialsHelper(); }
CredentialsHelper { static CredentialsBean populateCredentials(CredentialsBean credentials, String username, String password) { if (credentials == null || credentials.isEmpty()) { return new CredentialsBean(username, password); } if (StringUtils.isNotBlank(credentials.getUsername())) { username = credentials.getUsername(); } if (StringUtils.isNotBlank(credentials.getPassword())) { password = credentials.getPassword(); } return new CredentialsBean(username, password); } private  CredentialsHelper(); static CredentialsBean getPreferredResolvingCredentials(ServerConfigBean serverConfigBean,
                                                                   boolean overrideDeployerCredentials,
                                                                   String username, String password); static CredentialsBean getPreferredDeployingCredentials(ServerConfigBean serverConfigBean,
                                                                   boolean overrideDeployerCredentials,
                                                                   String username, String password); }
CredentialsHelper { static CredentialsBean populateCredentials(CredentialsBean credentials, String username, String password) { if (credentials == null || credentials.isEmpty()) { return new CredentialsBean(username, password); } if (StringUtils.isNotBlank(credentials.getUsername())) { username = credentials.getUsername(); } if (StringUtils.isNotBlank(credentials.getPassword())) { password = credentials.getPassword(); } return new CredentialsBean(username, password); } private  CredentialsHelper(); static CredentialsBean getPreferredResolvingCredentials(ServerConfigBean serverConfigBean,
                                                                   boolean overrideDeployerCredentials,
                                                                   String username, String password); static CredentialsBean getPreferredDeployingCredentials(ServerConfigBean serverConfigBean,
                                                                   boolean overrideDeployerCredentials,
                                                                   String username, String password);  }