### Question:
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);  }### Answer:
@Test public void testUpdateUserNameAzure() { String updatedUserName = underTest.updateUserName(USER_NAME, Optional.of(CloudPlatform.AZURE), DB_HOST_NAME); assertEquals(USER_NAME + "@" + DB_SHORT_HOST_NAME, updatedUserName); }
@Test public void testUpdateUserNameDefault() { String updatedUserName = underTest.updateUserName(USER_NAME, Optional.of(CloudPlatform.MOCK), DB_HOST_NAME); assertEquals(USER_NAME, updatedUserName); }
@Test public void testUpdateUserNamePlatformUnknown() { String updatedUserName = underTest.updateUserName(USER_NAME, Optional.empty(), DB_HOST_NAME); assertEquals(USER_NAME, updatedUserName); }