FileDocCategorySizeDatePackage
Rfc822ValidatorTest.javaAPI DocAndroid 5.1 API5616Thu Mar 12 22:22:48 GMT 2015com.android.common

Rfc822ValidatorTest.java

/*
 * Copyright (C) 2010 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.common;

import android.test.suitebuilder.annotation.SmallTest;

import junit.framework.TestCase;

import java.util.HashMap;
import java.util.Map;

public class Rfc822ValidatorTest extends TestCase {
    static final String[] VALID_EMAILS = new String[] {
            "a@example.org", "b@exemple.fr", "c@d.e-f",
            "Very.Common@example.org",
            "john@EXAMPLE.ORG",
            "john@a123b.c-d.dept.example.com",
            "xn--r8jz45g@example.com",
            "disposable.style.email.with+symbol@example.com",
            "other.email-with-dash@example.com",
            "!#$%&'*+-/=?^_`{}|~@example.com",  // Use of allowed special characters.
            "a@domain-label-cannot-be-longer-than-63-chars-and-this-is-maximum.example.com",
            // Valid de facto, even if RFC doesn't allow it.
            "a..b@example.com", ".a@example.com", "b.@example.com",
            // Punycode is an ASCII representation of International domain names.
            "john.doe@xn--r8jz45g.xn--zckzah",
            "john.doe@XN--R8JZ45G.XN--ZXKZAH",
            "xn--r8jz45g@xn--r8jz45g.XN--ZXKZAH",
            // Quoted address.
            // TODO(regisd) Fix Rfc822Tokenizer which loses the quotes.
            // "\"much.more unusual\"",
            // "\"very.unusual.@.unusual.com\""

            // Valid only in new Internalized email address.
             "a@\u00E9.example.com",
            //"ã