### Question:
TransportUris { public static ServerSettings decodeTransportUri(String uri) { if (uri.startsWith("smtp")) { return decodeSmtpUri(uri); } else if (uri.startsWith("webdav")) { return decodeWebDavUri(uri); } else if (uri.startsWith("ews")) { return decodeEwsUri(uri); } else { throw new IllegalArgumentException("Not a valid transport URI"); } }  static ServerSettings decodeTransportUri(String uri); static String createTransportUri(ServerSettings server);  }### Answer:
@Test public void decodeTransportUri_canDecodeAuthType() { String storeUri = "smtp: ServerSettings result = TransportUris.decodeTransportUri(storeUri); assertEquals(AuthType.PLAIN, result.authenticationType); }
@Test public void decodeTransportUri_canDecodeUsername() { String storeUri = "smtp: ServerSettings result = TransportUris.decodeTransportUri(storeUri); assertEquals("user", result.username); }
@Test public void decodeTransportUri_canDecodePassword() { String storeUri = "smtp: ServerSettings result = TransportUris.decodeTransportUri(storeUri); assertEquals("password", result.password); }
@Test public void decodeTransportUri_canDecodeUsername_withNoAuthType() { String storeUri = "smtp: ServerSettings result = TransportUris.decodeTransportUri(storeUri); assertEquals("user", result.username); }
@Test public void decodeTransportUri_canDecodeUsername_withNoPasswordOrAuthType() { String storeUri = "smtp: ServerSettings result = TransportUris.decodeTransportUri(storeUri); assertEquals("user", result.username); }
@Test public void decodeTransportUri_canDecodeAuthType_withEmptyPassword() { String storeUri = "smtp: ServerSettings result = TransportUris.decodeTransportUri(storeUri); assertEquals(AuthType.PLAIN, result.authenticationType); }
@Test public void decodeTransportUri_canDecodeHost() { String storeUri = "smtp: ServerSettings result = TransportUris.decodeTransportUri(storeUri); assertEquals("server", result.host); }
@Test public void decodeTransportUri_canDecodePort() { String storeUri = "smtp: ServerSettings result = TransportUris.decodeTransportUri(storeUri); assertEquals(123456, result.port); }
@Test public void decodeTransportUri_canDecodeTLS() { String storeUri = "smtp+tls+: ServerSettings result = TransportUris.decodeTransportUri(storeUri); assertEquals(ConnectionSecurity.STARTTLS_REQUIRED, result.connectionSecurity); }
@Test public void decodeTransportUri_canDecodeSSL() { String storeUri = "smtp+ssl+: ServerSettings result = TransportUris.decodeTransportUri(storeUri); assertEquals(ConnectionSecurity.SSL_TLS_REQUIRED, result.connectionSecurity); }
@Test public void decodeTransportUri_canDecodeClientCert() { String storeUri = "smtp+ssl+: ServerSettings result = TransportUris.decodeTransportUri(storeUri); assertEquals("clientCert", result.clientCertificateAlias); }
@Test(expected = IllegalArgumentException.class) public void decodeTransportUri_forUnknownSchema_throwsIllegalArgumentException() { String storeUri = "unknown: TransportUris.decodeTransportUri(storeUri); }