@Test public void testCaseInsensitiveParamWrapper() { Uri uri = Uri.parse("scheme: CaseInsensitiveParamWrapper caseInsensitiveParamWrapper = new CaseInsensitiveParamWrapper(uri); List<String> result = caseInsensitiveParamWrapper.getQueryParameters("b"); assertThat(Collections.singletonList("two"), is(result)); }
public static MailTo parse(Uri uri) throws NullPointerException, IllegalArgumentException { if (uri == null || uri.toString() == null) { throw new NullPointerException("Argument 'uri' must not be null"); } if (!isMailTo(uri)) { throw new IllegalArgumentException("Not a mailto scheme"); } String schemaSpecific = uri.getSchemeSpecificPart(); int end = schemaSpecific.indexOf('?'); if (end == -1) { end = schemaSpecific.length(); } CaseInsensitiveParamWrapper params = new CaseInsensitiveParamWrapper(Uri.parse("foo: String recipient = Uri.decode(schemaSpecific.substring(0, end)); List<String> toList = params.getQueryParameters(TO); if (recipient.length() != 0) { toList.add(0, recipient); } List<String> ccList = params.getQueryParameters(CC); List<String> bccList = params.getQueryParameters(BCC); Address[] toAddresses = toAddressArray(toList); Address[] ccAddresses = toAddressArray(ccList); Address[] bccAddresses = toAddressArray(bccList); String subject = getFirstParameterValue(params, SUBJECT); String body = getFirstParameterValue(params, BODY); return new MailTo(toAddresses, ccAddresses, bccAddresses, subject, body); }
MailTo { public static MailTo parse(Uri uri) throws NullPointerException, IllegalArgumentException { if (uri == null || uri.toString() == null) { throw new NullPointerException("Argument 'uri' must not be null"); } if (!isMailTo(uri)) { throw new IllegalArgumentException("Not a mailto scheme"); } String schemaSpecific = uri.getSchemeSpecificPart(); int end = schemaSpecific.indexOf('?'); if (end == -1) { end = schemaSpecific.length(); } CaseInsensitiveParamWrapper params = new CaseInsensitiveParamWrapper(Uri.parse("foo: String recipient = Uri.decode(schemaSpecific.substring(0, end)); List<String> toList = params.getQueryParameters(TO); if (recipient.length() != 0) { toList.add(0, recipient); } List<String> ccList = params.getQueryParameters(CC); List<String> bccList = params.getQueryParameters(BCC); Address[] toAddresses = toAddressArray(toList); Address[] ccAddresses = toAddressArray(ccList); Address[] bccAddresses = toAddressArray(bccList); String subject = getFirstParameterValue(params, SUBJECT); String body = getFirstParameterValue(params, BODY); return new MailTo(toAddresses, ccAddresses, bccAddresses, subject, body); } }
MailTo { public static MailTo parse(Uri uri) throws NullPointerException, IllegalArgumentException { if (uri == null || uri.toString() == null) { throw new NullPointerException("Argument 'uri' must not be null"); } if (!isMailTo(uri)) { throw new IllegalArgumentException("Not a mailto scheme"); } String schemaSpecific = uri.getSchemeSpecificPart(); int end = schemaSpecific.indexOf('?'); if (end == -1) { end = schemaSpecific.length(); } CaseInsensitiveParamWrapper params = new CaseInsensitiveParamWrapper(Uri.parse("foo: String recipient = Uri.decode(schemaSpecific.substring(0, end)); List<String> toList = params.getQueryParameters(TO); if (recipient.length() != 0) { toList.add(0, recipient); } List<String> ccList = params.getQueryParameters(CC); List<String> bccList = params.getQueryParameters(BCC); Address[] toAddresses = toAddressArray(toList); Address[] ccAddresses = toAddressArray(ccList); Address[] bccAddresses = toAddressArray(bccList); String subject = getFirstParameterValue(params, SUBJECT); String body = getFirstParameterValue(params, BODY); return new MailTo(toAddresses, ccAddresses, bccAddresses, subject, body); } private  MailTo(Address[] toAddresses, Address[] ccAddresses, Address[] bccAddresses, String subject, String body); }
MailTo { public static MailTo parse(Uri uri) throws NullPointerException, IllegalArgumentException { if (uri == null || uri.toString() == null) { throw new NullPointerException("Argument 'uri' must not be null"); } if (!isMailTo(uri)) { throw new IllegalArgumentException("Not a mailto scheme"); } String schemaSpecific = uri.getSchemeSpecificPart(); int end = schemaSpecific.indexOf('?'); if (end == -1) { end = schemaSpecific.length(); } CaseInsensitiveParamWrapper params = new CaseInsensitiveParamWrapper(Uri.parse("foo: String recipient = Uri.decode(schemaSpecific.substring(0, end)); List<String> toList = params.getQueryParameters(TO); if (recipient.length() != 0) { toList.add(0, recipient); } List<String> ccList = params.getQueryParameters(CC); List<String> bccList = params.getQueryParameters(BCC); Address[] toAddresses = toAddressArray(toList); Address[] ccAddresses = toAddressArray(ccList); Address[] bccAddresses = toAddressArray(bccList); String subject = getFirstParameterValue(params, SUBJECT); String body = getFirstParameterValue(params, BODY); return new MailTo(toAddresses, ccAddresses, bccAddresses, subject, body); } private  MailTo(Address[] toAddresses, Address[] ccAddresses, Address[] bccAddresses, String subject, String body); static boolean isMailTo(Uri uri); static MailTo parse(Uri uri); Address[] getTo(); Address[] getCc(); Address[] getBcc(); String getSubject(); String getBody(); }
MailTo { public static MailTo parse(Uri uri) throws NullPointerException, IllegalArgumentException { if (uri == null || uri.toString() == null) { throw new NullPointerException("Argument 'uri' must not be null"); } if (!isMailTo(uri)) { throw new IllegalArgumentException("Not a mailto scheme"); } String schemaSpecific = uri.getSchemeSpecificPart(); int end = schemaSpecific.indexOf('?'); if (end == -1) { end = schemaSpecific.length(); } CaseInsensitiveParamWrapper params = new CaseInsensitiveParamWrapper(Uri.parse("foo: String recipient = Uri.decode(schemaSpecific.substring(0, end)); List<String> toList = params.getQueryParameters(TO); if (recipient.length() != 0) { toList.add(0, recipient); } List<String> ccList = params.getQueryParameters(CC); List<String> bccList = params.getQueryParameters(BCC); Address[] toAddresses = toAddressArray(toList); Address[] ccAddresses = toAddressArray(ccList); Address[] bccAddresses = toAddressArray(bccList); String subject = getFirstParameterValue(params, SUBJECT); String body = getFirstParameterValue(params, BODY); return new MailTo(toAddresses, ccAddresses, bccAddresses, subject, body); } private  MailTo(Address[] toAddresses, Address[] ccAddresses, Address[] bccAddresses, String subject, String body); static boolean isMailTo(Uri uri); static MailTo parse(Uri uri); Address[] getTo(); Address[] getCc(); Address[] getBcc(); String getSubject(); String getBody();  }