### Question:
DbUsernameConverterService { public String toConnectionUsername(String host, String dbUser) { if (isAzure(host)) { LOGGER.debug("Detected Azure database server {}, appending short hostname to connection username", host); return dbUser + "@" + StringUtils.substringBefore(host, "."); } return dbUser; }  String toConnectionUsername(String host, String dbUser); String toDatabaseUsername(String username);  }### Answer:
@Test public void testWhenToConnectionUsernameOnAzure() { String username = dbUsernameConverterService.toConnectionUsername("hostname" + AZURE_DB_HOST_DOMAIN, "username"); assertEquals("username@hostname", username); }
@Test public void testWhenToConnectionUsernameNotOnAzure() { String username = dbUsernameConverterService.toConnectionUsername("hostname.something.com", "username"); assertEquals("username", username); }