@Test public void testUpdateUserNamePlatformUnknown() { String updatedUserName = underTest.updateUserName(USER_NAME, Optional.empty(), DB_HOST_NAME); assertEquals(USER_NAME, updatedUserName); }
public String updateUserName(String originalUserName, Optional<CloudPlatform> cloudPlatform, String dbHostname) { if (!cloudPlatform.isPresent()) { return originalUserName; } String updatedUserName; switch (cloudPlatform.get()) { case AZURE: String dbShortHostname = dbHostname.split("\\.")[0]; updatedUserName = originalUserName + "@" + dbShortHostname; LOGGER.debug("Updating username for Azure to {}", updatedUserName); break; default: updatedUserName = originalUserName; break; } return updatedUserName; }
UserGeneratorService { public String updateUserName(String originalUserName, Optional<CloudPlatform> cloudPlatform, String dbHostname) { if (!cloudPlatform.isPresent()) { return originalUserName; } String updatedUserName; switch (cloudPlatform.get()) { case AZURE: String dbShortHostname = dbHostname.split("\\.")[0]; updatedUserName = originalUserName + "@" + dbShortHostname; LOGGER.debug("Updating username for Azure to {}", updatedUserName); break; default: updatedUserName = originalUserName; break; } return updatedUserName; } }
UserGeneratorService { public String updateUserName(String originalUserName, Optional<CloudPlatform> cloudPlatform, String dbHostname) { if (!cloudPlatform.isPresent()) { return originalUserName; } String updatedUserName; switch (cloudPlatform.get()) { case AZURE: String dbShortHostname = dbHostname.split("\\.")[0]; updatedUserName = originalUserName + "@" + dbShortHostname; LOGGER.debug("Updating username for Azure to {}", updatedUserName); break; default: updatedUserName = originalUserName; break; } return updatedUserName; }  }
UserGeneratorService { public String updateUserName(String originalUserName, Optional<CloudPlatform> cloudPlatform, String dbHostname) { if (!cloudPlatform.isPresent()) { return originalUserName; } String updatedUserName; switch (cloudPlatform.get()) { case AZURE: String dbShortHostname = dbHostname.split("\\.")[0]; updatedUserName = originalUserName + "@" + dbShortHostname; LOGGER.debug("Updating username for Azure to {}", updatedUserName); break; default: updatedUserName = originalUserName; break; } return updatedUserName; }  String generateUserName(); String updateUserName(String originalUserName, Optional<CloudPlatform> cloudPlatform, String dbHostname); }
UserGeneratorService { public String updateUserName(String originalUserName, Optional<CloudPlatform> cloudPlatform, String dbHostname) { if (!cloudPlatform.isPresent()) { return originalUserName; } String updatedUserName; switch (cloudPlatform.get()) { case AZURE: String dbShortHostname = dbHostname.split("\\.")[0]; updatedUserName = originalUserName + "@" + dbShortHostname; LOGGER.debug("Updating username for Azure to {}", updatedUserName); break; default: updatedUserName = originalUserName; break; } return updatedUserName; }  String generateUserName(); String updateUserName(String originalUserName, Optional<CloudPlatform> cloudPlatform, String dbHostname);  }