FileDocCategorySizeDatePackage
VCardImporterTests.javaAPI DocAndroid 5.1 API79153Thu Mar 12 22:22:54 GMT 2015com.android.vcard.tests

VCardImporterTests

public class VCardImporterTests extends com.android.vcard.tests.testutils.VCardTestsBase

Fields Summary
private static final int[]
sPhotoIntArrayForComplicatedCase
static final byte[]
sPhotoByteArrayForComplicatedCase
Constructors Summary
Methods Summary
public voidtestAdrMultipleLineV21()

        ContentValues contentValuesForValue = new ContentValues();
        contentValuesForValue.put("VALUE", "DATE");

        mVerifier.initForImportTest(V21, R.raw.v21_adr_multiple_line);
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("N", "bogus")
                .addExpectedNodeWithOrder("URL", "http://bogus.com/")
                .addExpectedNodeWithOrder("ADR",
                        ";;Grindelberg 999;Hamburg;;99999;Deutschland",
                        Arrays.asList("", "", "Grindelberg 999", "Hamburg", "", "99999",
                                "Deutschland"),
                        new TypeSet("HOME"))
                .addExpectedNodeWithOrder("ADR", ";;Hermann v. Brevern\\ 9999999\\ " +
                        "Packstation 999;Hamburg;;99999;Deutschland",
                        Arrays.asList("", "", "Hermann v. Brevern\\ 9999999\\ Packstation 999",
                                "Hamburg", "", "99999", "Deutschland"),
                        new TypeSet("HOME"))
                .addExpectedNodeWithOrder("BDAY", "20081203", contentValuesForValue);
    
public voidtestAndroidCustomPropertyV21()

        mVerifier.initForImportTest(V21, R.raw.v21_android_custom_prop);
        final ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected("custom_mime1")
                .put("data1", "1").put("data2", "2").put("data3", "3").put("data4", "4")
                .put("data5", "5").put("data6", "6").put("data7", "7").put("data8", "8")
                .put("data9", "9").put("data10", "10").put("data11", "11").put("data12", "12")
                .put("data13", "13").put("data14", "14").put("data15", "15");
        // 16'th elemnt ('p') should be ignored
        elem.addExpected("custom_mime2")
                .put("data1", "a").put("data2", "b").put("data3", "c").put("data4", "d")
                .put("data5", "e").put("data6", "f").put("data7", "g").put("data8", "h")
                .put("data9", "i").put("data10", "j").put("data11", "k").put("data12", "l")
                .put("data13", "m").put("data14", "n").put("data15", "o");

        // custom_mime3 shouldn't be here, as there's no data

        // Smoke test.
        elem.addExpected("custom_mime4").put("data1", "z");
    
public voidtestBase64Without2CrLfForBlackBerry_Parse()

        mVerifier.initForImportTest(V21, R.raw.v21_blackberry_photo);
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("FN", "boogie")
                .addExpectedNodeWithOrder("N", "boogie")
                .addExpectedNodeWithOrder("PHOTO", null,
                        null, sPhotoByteArrayForComplicatedCase, mContentValuesForBase64V21,
                        null, null)
                .addExpectedNodeWithOrder("TEL", "+5555555", new TypeSet("WORK"))
                .addExpectedNodeWithOrder("TEL", "+5555556", new TypeSet("CELL"))
                .addExpectedNodeWithOrder("EMAIL", "forrestgump@walladalla.com",
                        new TypeSet("INTERNET"));
    
public voidtestBase64Without2CrLf_Parse()

        mVerifier.initForImportTest(V21, R.raw.v21_base64_no_2_crlf);
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("N", "name")
                .addExpectedNodeWithOrder("FN", "fullname")
                .addExpectedNodeWithOrder("PHOTO", null,
                        null, sPhotoByteArrayForComplicatedCase, mContentValuesForBase64V21,
                        new TypeSet("JPEG"), null);
    
public voidtestCommaSeparatedParamsV30_Parse()

        mVerifier.initForImportTest(V30, R.raw.v30_comma_separated);
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("N", Arrays.asList("F", "G", "M", "", ""),
                        new TypeSet("PREF", "HOME"))
                .addExpectedNodeWithOrder("TEL", "1",
                        new TypeSet("COMMA,SEPARATED:INSIDE.DQUOTE", "PREF"));
    
public voidtestCustomPropertyV21()

        mVerifier.initForImportTest(V21, R.raw.v21_x_param);
        final ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.FAMILY_NAME, "Ando")
                .put(StructuredName.GIVEN_NAME, "Roid")
                .put(StructuredName.DISPLAY_NAME, "Roid Ando");
        elem.addExpected(StructuredPostal.CONTENT_ITEM_TYPE)
                .put(StructuredPostal.TYPE, StructuredPostal.TYPE_CUSTOM)
                .put(StructuredPostal.LABEL, "custom")
                .put(StructuredPostal.POBOX, "pobox")
                .put(StructuredPostal.STREET, "street")
                .put(StructuredPostal.FORMATTED_ADDRESS, "pobox street");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
                .put(Phone.LABEL, "CuStoMpRop")
                .put(Phone.NUMBER, "1");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
                .put(Phone.LABEL, "custompropertywithoutx")
                .put(Phone.NUMBER, "2");
        elem.addExpected(Email.CONTENT_ITEM_TYPE)
                .put(Email.TYPE, Email.TYPE_CUSTOM)
                .put(Email.LABEL, "cUstomPrOperty")
                .put(Email.ADDRESS, "email@example.com");
        elem.addExpected(Email.CONTENT_ITEM_TYPE)
                .put(Email.TYPE, Email.TYPE_CUSTOM)
                .put(Email.LABEL, "CUSTOMPROPERTYWITHOUTX")
                .put(Email.ADDRESS, "email2@example.com");
    
public voidtestCustomPropertyV21_Parse()

        mVerifier.initForImportTest(V21, R.raw.v21_x_param);
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("N", "Ando;Roid;", Arrays.asList("Ando", "Roid", ""))
                .addExpectedNodeWithOrder("ADR", "pobox;street", Arrays.asList("pobox", "street"),
                        new TypeSet("X-custom"))
                .addExpectedNodeWithOrder("TEL", "1", new TypeSet("X-CuStoMpRop"))
                .addExpectedNodeWithOrder("TEL", "2", new TypeSet("custompropertywithoutx"))
                .addExpectedNodeWithOrder("EMAIL", "email@example.com",
                        new TypeSet("X-cUstomPrOperty"))
                .addExpectedNodeWithOrder("EMAIL", "email2@example.com",
                        new TypeSet("CUSTOMPROPERTYWITHOUTX"));
    
public voidtestIMV21()

        mVerifier.initForImportTest(V21, R.raw.v21_im);
        final ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(Nickname.CONTENT_ITEM_TYPE)
                .put(Nickname.NAME, "Nick")
                .put(Nickname.TYPE, "1");
        elem.addExpected(Im.CONTENT_ITEM_TYPE)
                .put(Im.PROTOCOL, Im.PROTOCOL_GOOGLE_TALK)
                .put(Im.TYPE, Im.TYPE_HOME)
                .put(Im.DATA, "hhh@gmail.com");
    
public voidtestIMV21_Parse()

        mVerifier.initForImportTest(V21, R.raw.v21_im);
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("X-ANDROID-CUSTOM",
                        Arrays.asList("vnd.android.cursor.item/nickname", "Nick", "1",
                                "", "", "", "", "", "", "", "", "", "", "", "", ""))  // 13
                .addExpectedNodeWithOrder("X-GOOGLE-TALK", "hhh@gmail.com");
    
public voidtestIgnoreAgentV21()

        mVerifier.initForImportTest(V21, R.raw.v21_winmo_65);
        ContentValuesVerifier verifier = new ContentValuesVerifier();
        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.FAMILY_NAME, "Example")
                .put(StructuredName.DISPLAY_NAME, "Example");
        elem.addExpected(Event.CONTENT_ITEM_TYPE)
                .put(Event.TYPE, Event.TYPE_ANNIVERSARY)
                .put(Event.START_DATE, "20091010");
    
public voidtestIgnoreAgentV21_Parse()

        mVerifier.initForImportTest(V21, R.raw.v21_winmo_65);
        ContentValues contentValuesForValue = new ContentValues();
        contentValuesForValue.put("VALUE", "DATE");
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("N", Arrays.asList("Example", "", "", "", ""))
                .addExpectedNodeWithOrder("FN", "Example")
                .addExpectedNodeWithOrder("ANNIVERSARY", "20091010", contentValuesForValue)
                .addExpectedNodeWithOrder("AGENT", "")
                .addExpectedNodeWithOrder("X-CLASS", "PUBLIC")
                .addExpectedNodeWithOrder("X-REDUCTION", "")
                .addExpectedNodeWithOrder("X-NO", "");
    
public voidtestInvalidMultipleLineV21()

        mVerifier.initForImportTest(V21, R.raw.v21_invalid_multiple_line);
        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.GIVEN_NAME, "Omega")
                .put(StructuredName.DISPLAY_NAME, "Omega");
        elem.addExpected(Email.CONTENT_ITEM_TYPE)
                .put(Email.TYPE, Email.TYPE_CUSTOM)
                .put(Email.LABEL, "INTERNET")
                .put(Email.ADDRESS, "\"Omega\" <omega@example.com>");
    
public voidtestMalformedBase64PhotoThrowsVCardException()

        mVerifier.initForImportTest(V21, R.raw.v21_malformed_photo);

        String expectedMsgContent = "qgEPAAIAAAAHAAAAugEQAAIAAAAG:ASDF==";
        mVerifier.addVCardExceptionVerifier(expectedMsgContent);
    
public voidtestMultiBytePropV30()

        mVerifier.initForImportTest(V30, R.raw.v30_multibyte_param);
        final ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.FAMILY_NAME, "F")
                .put(StructuredName.MIDDLE_NAME, "M")
                .put(StructuredName.GIVEN_NAME, "G")
                .put(StructuredName.DISPLAY_NAME, "G M F");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
                .put(Phone.LABEL, "\u8D39")
                .put(Phone.NUMBER, "1");
    
public voidtestMultiBytePropV30_Parse()

        mVerifier.initForImportTest(V30, R.raw.v30_multibyte_param);
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("N", Arrays.asList("F", "G", "M", "", ""))
                .addExpectedNodeWithOrder("TEL", "1", new TypeSet("\u8D39"));
    
public voidtestOrgBeforTitle()

        mVerifier.initForImportTest(V21, R.raw.v21_org_before_title);
        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.DISPLAY_NAME, "Normal Guy");
        elem.addExpected(Organization.CONTENT_ITEM_TYPE)
                .put(Organization.COMPANY, "Company")
                .put(Organization.DEPARTMENT, "Organization Devision Room Sheet No.")
                .put(Organization.TITLE, "Excellent Janitor")
                .put(Organization.TYPE, Organization.TYPE_WORK);
    
public voidtestPagerV30()

        mVerifier.initForImportTest(V30, R.raw.v30_pager);
        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.FAMILY_NAME, "F")
                .put(StructuredName.MIDDLE_NAME, "M")
                .put(StructuredName.GIVEN_NAME, "G")
                .put(StructuredName.DISPLAY_NAME, "G M F");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_PAGER)
                .put(Phone.NUMBER, "6101231234@pagersample.com");
    
public voidtestPagerV30_Parse()

        mVerifier.initForImportTest(V30, R.raw.v30_pager);
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("N", Arrays.asList("F", "G", "M", "", ""))
                .addExpectedNodeWithOrder("TEL", "6101231234@pagersample.com",
                        new TypeSet("WORK", "MSG", "PAGER"));
    
public voidtestPauseWaitV30()

        mVerifier.initForImportTest(V30, R.raw.v30_pause_wait);
        final ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.FAMILY_NAME, "Pause")
                .put(StructuredName.GIVEN_NAME, "Wait")
                .put(StructuredName.DISPLAY_NAME, "Pause Wait");
        // See PhoneNumberUtils in Android SDK.
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_HOME)
                .put(Phone.NUMBER, ",1234,5678;9");
    
public voidtestPauseWaitV30_Parse()

        mVerifier.initForImportTest(V30, R.raw.v30_pause_wait);
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("FN", "Pause Wait")
                .addExpectedNodeWithOrder("N", "Pause;Wait;;;",
                        Arrays.asList("Pause", "Wait", "", "", ""))
                .addExpectedNodeWithOrder("TEL", "p1234p5678w9");
     
public voidtestSipV21()

        mVerifier.initForImportTest(V21, R.raw.v21_sip);
        final ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.DISPLAY_NAME, "Android");
        elem.addExpected(SipAddress.CONTENT_ITEM_TYPE)
                .put(SipAddress.TYPE, SipAddress.TYPE_OTHER)
                .put(SipAddress.SIP_ADDRESS, "888");
        // "sip:" should be removed.
        elem.addExpected(SipAddress.CONTENT_ITEM_TYPE)
                .put(SipAddress.TYPE, SipAddress.TYPE_OTHER)
                .put(SipAddress.SIP_ADDRESS, "90-180-360");
    
public voidtestSipV21_Parse()

        mVerifier.initForImportTest(V21, R.raw.v21_sip);
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("FN", "Android")
                .addExpectedNodeWithOrder("X-SIP", "888")
                .addExpectedNodeWithOrder("X-SIP", "sip:90-180-360");
    
public voidtestSipV30()

        mVerifier.initForImportTest(V30, R.raw.v30_sip);
        final ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.DISPLAY_NAME, "Android");
        // Type is ignored silently.
        elem.addExpected(SipAddress.CONTENT_ITEM_TYPE)
                .put(SipAddress.TYPE, SipAddress.TYPE_CUSTOM)
                .put(SipAddress.LABEL, "personal")
                .put(SipAddress.SIP_ADDRESS, "android@android.example.com");
    
public voidtestSipV30_Parse()

        mVerifier.initForImportTest(V30, R.raw.v30_sip);
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("FN", "Android")
                .addExpectedNodeWithOrder("IMPP", "sip:android@android.example.com",
                        new TypeSet("personal"));
    
public voidtestSipV40()

        mVerifier.initForImportTest(V40, R.raw.v40_sip);
        final ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.FAMILY_NAME, "\u5B89\u85E4")
                .put(StructuredName.GIVEN_NAME, "\u30ED\u30A4\u30C9")
                .put(StructuredName.DISPLAY_NAME, "\u5B89\u85E4\u0020\u30ED\u30A4\u30C9");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_HOME)
                .put(Phone.NUMBER, "1");
        elem.addExpected(SipAddress.CONTENT_ITEM_TYPE)
                .put(SipAddress.TYPE, SipAddress.TYPE_HOME)
                .put(SipAddress.SIP_ADDRESS, "example@example.com");
    
public voidtestSortAsV40()

        mVerifier.initForImportTest(V40, R.raw.v40_sort_as);
        final ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.FAMILY_NAME, "\u5B89\u85E4")
                .put(StructuredName.GIVEN_NAME, "\u30ED\u30A4\u30C9")
                .put(StructuredName.DISPLAY_NAME, "\u5B89\u85E4\u0020\u30ED\u30A4\u30C9")
                .put(StructuredName.PHONETIC_FAMILY_NAME, "\u3042\u3093\u3069\u3046")
                .put(StructuredName.PHONETIC_GIVEN_NAME,
                        "\u308D\u3044\u3069");
        elem.addExpected(Organization.CONTENT_ITEM_TYPE)
                .put(Organization.TYPE, Organization.TYPE_WORK)
                .put(Organization.COMPANY, "\u30B0\u30FC\u30B0\u30EB")
                .put(Organization.DEPARTMENT, "\u691C\u7D22\u90E8\u9580")
                .put(Organization.PHONETIC_NAME,
                        "\u3050\u30FC\u3050\u308B\u3051\u3093\u3055\u304F\u3076\u3082\u3093");
    
public voidtestSortAsV40_Parse()

        mVerifier.initForImportTest(V40, R.raw.v40_sort_as);

        final ContentValues contentValuesForSortAsN = new ContentValues();
        contentValuesForSortAsN.put("SORT-AS",
                "\u3042\u3093\u3069\u3046;\u308D\u3044\u3069");
        final ContentValues contentValuesForSortAsOrg = new ContentValues();
        contentValuesForSortAsOrg.put("SORT-AS",
                "\u3050\u30FC\u3050\u308B;\u3051\u3093\u3055\u304F\u3076\u3082\u3093");

        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("FN", "\u5B89\u85E4\u0020\u30ED\u30A4\u30C9")
                .addExpectedNodeWithOrder("N",
                        Arrays.asList("\u5B89\u85E4", "\u30ED\u30A4\u30C9", "", "", ""),
                        contentValuesForSortAsN)
                .addExpectedNodeWithOrder("ORG",
                        Arrays.asList("\u30B0\u30FC\u30B0\u30EB", "\u691C\u7D22\u90E8\u9580"),
                        contentValuesForSortAsOrg, new TypeSet("WORK"));
    
public voidtestTitleBeforOrg()

        mVerifier.initForImportTest(V21, R.raw.v21_title_before_org);
        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.DISPLAY_NAME, "Nice Guy");
        elem.addExpected(Organization.CONTENT_ITEM_TYPE)
                .put(Organization.COMPANY, "Marverous")
                .put(Organization.DEPARTMENT, "Perfect Great Good Bad Poor")
                .put(Organization.TITLE, "Cool Title")
                .put(Organization.TYPE, Organization.TYPE_WORK);
    
public voidtestTolerateInvalidCommentLikeLineV21()

        mVerifier.initForImportTest(V21, R.raw.v21_invalid_comment_line);
        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.GIVEN_NAME, "Conference Call")
                .put(StructuredName.DISPLAY_NAME, "Conference Call");
        elem.addExpected(Note.CONTENT_ITEM_TYPE)
                .put(Note.NOTE, "This is an (sharp ->#<- sharp) example. "
                        + "This message must NOT be ignored.");
    
public voidtestV21BackslashCase()
Tests ContactStruct correctly ignores redundant fields in "N" property values and inserts name related data.

        mVerifier.initForImportTest(V21, R.raw.v21_backslash);
        mVerifier.addContentValuesVerifierElem()
                .addExpected(StructuredName.CONTENT_ITEM_TYPE)
                        // FAMILY_NAME is empty and removed in this test...
                        .put(StructuredName.GIVEN_NAME, "A;B\\")
                        .put(StructuredName.MIDDLE_NAME, "C\\;")
                        .put(StructuredName.PREFIX, "D")
                        .put(StructuredName.SUFFIX, ":E")
                        .put(StructuredName.DISPLAY_NAME, "A;B\\C\\;D:E\\\\");
    
public voidtestV21BackslashCase_Parsing()
Tests ';' is properly handled by VCardParser implementation.

        mVerifier.initForImportTest(V21, R.raw.v21_backslash);
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("N", ";A;B\\;C\\;;D;:E;\\\\;",
                        Arrays.asList("", "A;B\\", "C\\;", "D", ":E", "\\\\", ""))
                .addExpectedNodeWithOrder("FN", "A;B\\C\\;D:E\\\\");

    
public voidtestV21ComplicatedCase()
Checks ContactStruct correctly inserts values in a complicated vCard into ContentResolver.

        mVerifier.initForImportTest(V21, R.raw.v21_complicated);
        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.FAMILY_NAME, "Gump")
                .put(StructuredName.GIVEN_NAME, "Forrest")
                .put(StructuredName.MIDDLE_NAME, "Hoge")
                .put(StructuredName.PREFIX, "Pos")
                .put(StructuredName.SUFFIX, "Tao")
                .put(StructuredName.DISPLAY_NAME, "Joe Due");
        elem.addExpected(Organization.CONTENT_ITEM_TYPE)
                .put(Organization.TYPE, Organization.TYPE_WORK)
                .put(Organization.COMPANY, "Gump Shrimp Co.")
                .put(Organization.DEPARTMENT, "Sales Dept.;Manager Fish keeper")
                .put(Organization.TITLE, "Shrimp Man");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_WORK)
                // Phone number is expected to be formated with NAMP format in default.
                .put(Phone.NUMBER, "111-555-1212");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_HOME)
                .put(Phone.NUMBER, "404-555-1212");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_MOBILE)
                .put(Phone.NUMBER, "031-111-1111");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
                .put(Phone.LABEL, "VIDEO")
                .put(Phone.NUMBER, "032-222-2222");
        // vCard's VOICE type should become OTHER type on Android devices.
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_OTHER)
                .put(Phone.NUMBER, "033-333-3333");
        elem.addExpected(StructuredPostal.CONTENT_ITEM_TYPE)
                .put(StructuredPostal.TYPE, StructuredPostal.TYPE_WORK)
                .put(StructuredPostal.COUNTRY, "United States of America")
                .put(StructuredPostal.POSTCODE, "30314")
                .put(StructuredPostal.REGION, "LA")
                .put(StructuredPostal.CITY, "Baytown")
                .put(StructuredPostal.STREET, "100 Waters Edge")
                .put(StructuredPostal.FORMATTED_ADDRESS,
                        "100 Waters Edge Baytown LA 30314 United States of America");
        elem.addExpected(StructuredPostal.CONTENT_ITEM_TYPE)
                .put(StructuredPostal.TYPE, StructuredPostal.TYPE_HOME)
                .put(StructuredPostal.COUNTRY, "United States of America")
                .put(StructuredPostal.POSTCODE, "30314")
                .put(StructuredPostal.REGION, "LA")
                .put(StructuredPostal.CITY, "Baytown")
                .put(StructuredPostal.STREET, "42 Plantation St.")
                .put(StructuredPostal.FORMATTED_ADDRESS,
                        "42 Plantation St. Baytown LA 30314 United States of America");
        elem.addExpected(Email.CONTENT_ITEM_TYPE)
                // "TYPE=INTERNET" -> TYPE_CUSTOM + the label "INTERNET"
                .put(Email.TYPE, Email.TYPE_CUSTOM)
                .put(Email.LABEL, "INTERNET")
                .put(Email.DATA, "forrestgump@walladalla.com")
                .put(Email.IS_PRIMARY, 1);
        elem.addExpected(Email.CONTENT_ITEM_TYPE)
                .put(Email.TYPE, Email.TYPE_MOBILE)
                .put(Email.DATA, "cell@example.com");
        elem.addExpected(Note.CONTENT_ITEM_TYPE)
                .put(Note.NOTE, "The following note is the example from RFC 2045.");
        elem.addExpected(Note.CONTENT_ITEM_TYPE)
                .put(Note.NOTE,
                        "Now's the time for all folk to come to the aid of their country.");
        elem.addExpected(Photo.CONTENT_ITEM_TYPE)
                // No information about its image format can be inserted.
                .put(Photo.PHOTO, sPhotoByteArrayForComplicatedCase);
        elem.addExpected(Event.CONTENT_ITEM_TYPE)
                .put(Event.START_DATE, "19800101")
                .put(Event.TYPE, Event.TYPE_BIRTHDAY);
        elem.addExpected(Website.CONTENT_ITEM_TYPE)
                .put(Website.URL, "http://www.example.com/")
                .put(Website.TYPE, Website.TYPE_HOMEPAGE);
    
public voidtestV21ComplicatedCase_Parsing()
Tests all the properties in a complicated vCard are correctly parsed by the VCardParser.

        mVerifier.initForImportTest(V21, R.raw.v21_complicated);
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("N", "Gump;Forrest;Hoge;Pos;Tao",
                        Arrays.asList("Gump", "Forrest", "Hoge", "Pos", "Tao"))
                .addExpectedNodeWithOrder("FN", "Joe Due")
                .addExpectedNodeWithOrder("ORG",
                        "Gump Shrimp Co.;Sales Dept.;Manager;Fish keeper",
                        Arrays.asList("Gump Shrimp Co.", "Sales Dept.;Manager", "Fish keeper"))
                .addExpectedNodeWithOrder("ROLE", "Fish Cake Keeper!")
                .addExpectedNodeWithOrder("TITLE", "Shrimp Man")
                .addExpectedNodeWithOrder("X-CLASS", "PUBLIC")
                .addExpectedNodeWithOrder("TEL", "(111) 555-1212", new TypeSet("WORK", "VOICE"))
                .addExpectedNodeWithOrder("TEL", "(404) 555-1212", new TypeSet("HOME", "VOICE"))
                .addExpectedNodeWithOrder("TEL", "0311111111", new TypeSet("CELL"))
                .addExpectedNodeWithOrder("TEL", "0322222222", new TypeSet("VIDEO"))
                .addExpectedNodeWithOrder("TEL", "0333333333", new TypeSet("VOICE"))
                .addExpectedNodeWithOrder("ADR",
                        ";;100 Waters Edge;Baytown;LA;30314;United States of America",
                        Arrays.asList("", "", "100 Waters Edge", "Baytown",
                                "LA", "30314", "United States of America"),
                                null, null, new TypeSet("WORK"), null)
                .addExpectedNodeWithOrder("LABEL",
                        "100 Waters Edge\r\nBaytown, LA 30314\r\nUnited  States of America",
                        null, null, mContentValuesForQP, new TypeSet("WORK"), null)
                .addExpectedNodeWithOrder("ADR",
                        ";;42 Plantation St.;Baytown;LA;30314;United States of America",
                        Arrays.asList("", "", "42 Plantation St.", "Baytown",
                                "LA", "30314", "United States of America"), null, null,
                                new TypeSet("HOME"), null)
                .addExpectedNodeWithOrder("LABEL",
                        "42 Plantation St.\r\nBaytown, LA 30314\r\nUnited  States of America",
                        null, null, mContentValuesForQP,
                        new TypeSet("HOME"), null)
                .addExpectedNodeWithOrder("EMAIL", "forrestgump@walladalla.com",
                        new TypeSet("PREF", "INTERNET"))
                .addExpectedNodeWithOrder("EMAIL", "cell@example.com", new TypeSet("CELL"))
                .addExpectedNodeWithOrder("NOTE",
                        "The following note is the example from RFC 2045.")
                .addExpectedNodeWithOrder("NOTE",
                        "Now's the time for all folk to come to the aid of their country.",
                        null, null, mContentValuesForQP, null, null)
                .addExpectedNodeWithOrder("PHOTO", null,
                        null, sPhotoByteArrayForComplicatedCase, mContentValuesForBase64V21,
                        new TypeSet("JPEG"), null)
                .addExpectedNodeWithOrder("X-ATTRIBUTE", "Some String")
                .addExpectedNodeWithOrder("BDAY", "19800101")
                .addExpectedNodeWithOrder("GEO", "35.6563854,139.6994233")
                .addExpectedNodeWithOrder("URL", "http://www.example.com/")
                .addExpectedNodeWithOrder("REV", "20080424T195243Z");
    
private voidtestV21Japanese1Common(int resId, int vcardType, boolean japanese)

        mVerifier.initForImportTest(vcardType, resId);
        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.FAMILY_NAME, "\u5B89\u85E4\u30ED\u30A4\u30C9")
                .put(StructuredName.DISPLAY_NAME, "\u5B89\u85E4\u30ED\u30A4\u30C9")
                // While vCard parser does not split "SOUND" property values,
                // ContactStruct care it.
                .put(StructuredName.PHONETIC_GIVEN_NAME,
                        "\uFF71\uFF9D\uFF84\uFF9E\uFF73\uFF9B\uFF72\uFF84\uFF9E");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                // Phone number formatting is different.
                .put(Phone.NUMBER, (japanese ? "03-0000-0000" : "030-000-0000"))
                .put(Phone.TYPE, Phone.TYPE_OTHER)
                .put(Phone.IS_PRIMARY, 1);
    
public voidtestV21Japanese1_Parsing()

        // Though Japanese careers append ";;;;" at the end of the value of "SOUND",
        // vCard 2.1/3.0 specification does not allow multiple values.
        // Do not need to handle it as multiple values.
        mVerifier.initForImportTest(VCardConfig.VCARD_TYPE_V21_JAPANESE, R.raw.v21_japanese_1);
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("N", "\u5B89\u85E4\u30ED\u30A4\u30C9;;;;",
                        Arrays.asList("\u5B89\u85E4\u30ED\u30A4\u30C9", "", "", "", ""),
                        null, mContentValuesForSJis, null, null)
                .addExpectedNodeWithOrder("SOUND",
                        "\uFF71\uFF9D\uFF84\uFF9E\uFF73\uFF9B\uFF72\uFF84\uFF9E;;;;",
                        null, null, mContentValuesForSJis,
                        new TypeSet("X-IRMC-N"), null)
                .addExpectedNodeWithOrder("TEL", "0300000000", null, null, null,
                        new TypeSet("VOICE", "PREF"), null);
    
public voidtestV21Japanese1_Type_Generic_Utf8()
Verifies vCard with Japanese can be parsed correctly with {@link com.android.vcard.VCardConfig#VCARD_TYPE_V21_GENERIC}.

        testV21Japanese1Common(
                R.raw.v21_japanese_1, VCardConfig.VCARD_TYPE_V21_GENERIC, false);
    
public voidtestV21Japanese1_Type_Japanese_Sjis()
Verifies vCard with Japanese can be parsed correctly with {@link com.android.vcard.VCardConfig#VCARD_TYPE_V21_JAPANESE}.

        testV21Japanese1Common(
                R.raw.v21_japanese_1, VCardConfig.VCARD_TYPE_V21_JAPANESE, true);
    
public voidtestV21Japanese1_Type_Japanese_Utf8()
Verifies vCard with Japanese can be parsed correctly with {@link com.android.vcard.VCardConfig#VCARD_TYPE_V21_JAPANESE}. since vCard 2.1 specifies the charset of each line if it contains non-Ascii.

        testV21Japanese1Common(
                R.raw.v21_japanese_1, VCardConfig.VCARD_TYPE_V21_JAPANESE, true);
    
public voidtestV21Japanese2_Parsing()

        mVerifier.initForImportTest(VCardConfig.VCARD_TYPE_V21_JAPANESE, R.raw.v21_japanese_2);
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("N", "\u5B89\u85E4;\u30ED\u30A4\u30C9\u0031;;;",
                        Arrays.asList("\u5B89\u85E4", "\u30ED\u30A4\u30C9\u0031",
                                "", "", ""),
                        null, mContentValuesForSJis, null, null)
                .addExpectedNodeWithOrder("FN", "\u5B89\u85E4\u0020\u30ED\u30A4\u30C9\u0020\u0031",
                        null, null, mContentValuesForSJis, null, null)
                .addExpectedNodeWithOrder("SOUND",
                        "\uFF71\uFF9D\uFF84\uFF9E\uFF73;\uFF9B\uFF72\uFF84\uFF9E\u0031;;;",
                        null, null, mContentValuesForSJis,
                        new TypeSet("X-IRMC-N"), null)
                .addExpectedNodeWithOrder("ADR",
                        ";\u6771\u4EAC\u90FD\u6E0B\u8C37\u533A\u685C" +
                        "\u4E18\u753A\u0032\u0036\u002D\u0031\u30BB" +
                        "\u30EB\u30EA\u30A2\u30F3\u30BF\u30EF\u30FC\u0036" +
                        "\u968E;;;;150-8512;",
                        Arrays.asList("",
                                "\u6771\u4EAC\u90FD\u6E0B\u8C37\u533A\u685C" +
                                "\u4E18\u753A\u0032\u0036\u002D\u0031\u30BB" +
                                "\u30EB\u30EA\u30A2\u30F3\u30BF\u30EF\u30FC" +
                                "\u0036\u968E", "", "", "", "150-8512", ""),
                        null, mContentValuesForQPAndSJis, new TypeSet("HOME"), null)
                .addExpectedNodeWithOrder("NOTE", "\u30E1\u30E2", null, null,
                        mContentValuesForQPAndSJis, null, null);
    
public voidtestV21Japanese2_Type_Generic_Utf8()

        mVerifier.initForImportTest(V21, R.raw.v21_japanese_2);
        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.FAMILY_NAME, "\u5B89\u85E4")
                .put(StructuredName.GIVEN_NAME, "\u30ED\u30A4\u30C9\u0031")
                .put(StructuredName.DISPLAY_NAME,
                        "\u5B89\u85E4\u0020\u30ED\u30A4\u30C9\u0020\u0031")
                // ContactStruct should correctly split "SOUND" property into several elements,
                // even though VCardParser side does not care it.
                .put(StructuredName.PHONETIC_FAMILY_NAME, "\uFF71\uFF9D\uFF84\uFF9E\uFF73")
                .put(StructuredName.PHONETIC_GIVEN_NAME, "\uFF9B\uFF72\uFF84\uFF9E\u0031");
        elem.addExpected(StructuredPostal.CONTENT_ITEM_TYPE)
                .put(StructuredPostal.POSTCODE, "150-8512")
                .put(StructuredPostal.STREET,
                        "\u6771\u4EAC\u90FD\u6E0B\u8C37\u533A\u685C" +
                        "\u4E18\u753A\u0032\u0036\u002D\u0031\u30BB" +
                        "\u30EB\u30EA\u30A2\u30F3\u30BF\u30EF\u30FC" +
                        "\u0036\u968E")
                .put(StructuredPostal.FORMATTED_ADDRESS,
                        "\u6771\u4EAC\u90FD\u6E0B\u8C37\u533A\u685C" +
                        "\u4E18\u753A\u0032\u0036\u002D\u0031\u30BB" +
                        "\u30EB\u30EA\u30A2\u30F3\u30BF\u30EF\u30FC" +
                        "\u0036\u968E 150-8512")
                .put(StructuredPostal.TYPE, StructuredPostal.TYPE_HOME);
        elem.addExpected(Note.CONTENT_ITEM_TYPE)
                .put(Note.NOTE, "\u30E1\u30E2");
    
public voidtestV21MultipleEntryCase()

        mVerifier.initForImportTest(VCardConfig.VCARD_TYPE_V21_JAPANESE, R.raw.v21_multiple_entry);
        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.FAMILY_NAME, "\u5B89\u85E4\u30ED\u30A4\u30C9\u0033")
                .put(StructuredName.DISPLAY_NAME, "\u5B89\u85E4\u30ED\u30A4\u30C9\u0033")
                .put(StructuredName.PHONETIC_GIVEN_NAME,
                        "\uFF71\uFF9D\uFF84\uFF9E\uFF73\uFF9B\uFF72\uFF84\uFF9E\u0033");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
                .put(Phone.LABEL, "NEC-SECRET")
                .put(Phone.NUMBER, "9");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
                .put(Phone.LABEL, "NEC-HOTEL")
                .put(Phone.NUMBER, "10");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
                .put(Phone.LABEL, "NEC-SCHOOL")
                .put(Phone.NUMBER, "11");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_FAX_HOME)
                .put(Phone.NUMBER, "12");

        elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.FAMILY_NAME, "\u5B89\u85E4\u30ED\u30A4\u30C9\u0034")
                .put(StructuredName.DISPLAY_NAME, "\u5B89\u85E4\u30ED\u30A4\u30C9\u0034")
                .put(StructuredName.PHONETIC_GIVEN_NAME,
                        "\uFF71\uFF9D\uFF84\uFF9E\uFF73\uFF9B\uFF72\uFF84\uFF9E\u0034");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
                .put(Phone.LABEL, "MODEM")
                .put(Phone.NUMBER, "13");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_PAGER)
                .put(Phone.NUMBER, "14");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
                .put(Phone.LABEL, "NEC-FAMILY")
                .put(Phone.NUMBER, "15");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
                .put(Phone.LABEL, "NEC-GIRL")
                .put(Phone.NUMBER, "16");

        elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.FAMILY_NAME, "\u5B89\u85E4\u30ED\u30A4\u30C9\u0035")
                .put(StructuredName.DISPLAY_NAME, "\u5B89\u85E4\u30ED\u30A4\u30C9\u0035")
                .put(StructuredName.PHONETIC_GIVEN_NAME,
                        "\uFF71\uFF9D\uFF84\uFF9E\uFF73\uFF9B\uFF72\uFF84\uFF9E\u0035");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
                .put(Phone.LABEL, "NEC-BOY")
                .put(Phone.NUMBER, "17");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
                .put(Phone.LABEL, "NEC-FRIEND")
                .put(Phone.NUMBER, "18");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
                .put(Phone.LABEL, "NEC-PHS")
                .put(Phone.NUMBER, "19");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
                .put(Phone.LABEL, "NEC-RESTAURANT")
                .put(Phone.NUMBER, "20");
    
public voidtestV21MultipleEntryCase_Parse()

        mVerifier.initForImportTest(VCardConfig.VCARD_TYPE_V21_JAPANESE, R.raw.v21_multiple_entry);
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("N", "\u5B89\u85E4\u30ED\u30A4\u30C9\u0033;;;;",
                        Arrays.asList("\u5B89\u85E4\u30ED\u30A4\u30C9\u0033", "", "", "", ""),
                        null, mContentValuesForSJis, null, null)
                .addExpectedNodeWithOrder("SOUND",
                        "\uFF71\uFF9D\uFF84\uFF9E\uFF73\uFF9B\uFF72\uFF84\uFF9E\u0033;;;;",
                        null, null, mContentValuesForSJis,
                        new TypeSet("X-IRMC-N"), null)
                .addExpectedNodeWithOrder("TEL", "9", new TypeSet("X-NEC-SECRET"))
                .addExpectedNodeWithOrder("TEL", "10", new TypeSet("X-NEC-HOTEL"))
                .addExpectedNodeWithOrder("TEL", "11", new TypeSet("X-NEC-SCHOOL"))
                .addExpectedNodeWithOrder("TEL", "12", new TypeSet("FAX", "HOME"));
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("N", "\u5B89\u85E4\u30ED\u30A4\u30C9\u0034;;;;",
                        Arrays.asList("\u5B89\u85E4\u30ED\u30A4\u30C9\u0034", "", "", "", ""),
                        null, mContentValuesForSJis, null, null)
                .addExpectedNodeWithOrder("SOUND",
                        "\uFF71\uFF9D\uFF84\uFF9E\uFF73\uFF9B\uFF72\uFF84\uFF9E\u0034;;;;",
                        null, null, mContentValuesForSJis,
                        new TypeSet("X-IRMC-N"), null)
                .addExpectedNodeWithOrder("TEL", "13", new TypeSet("MODEM"))
                .addExpectedNodeWithOrder("TEL", "14", new TypeSet("PAGER"))
                .addExpectedNodeWithOrder("TEL", "15", new TypeSet("X-NEC-FAMILY"))
                .addExpectedNodeWithOrder("TEL", "16", new TypeSet("X-NEC-GIRL"));
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("N", "\u5B89\u85E4\u30ED\u30A4\u30C9\u0035;;;;",
                        Arrays.asList("\u5B89\u85E4\u30ED\u30A4\u30C9\u0035", "", "", "", ""),
                        null, mContentValuesForSJis, null, null)
                .addExpectedNodeWithOrder("SOUND",
                        "\uFF71\uFF9D\uFF84\uFF9E\uFF73\uFF9B\uFF72\uFF84\uFF9E\u0035;;;;",
                        null, null, mContentValuesForSJis,
                        new TypeSet("X-IRMC-N"), null)
                .addExpectedNodeWithOrder("TEL", "17", new TypeSet("X-NEC-BOY"))
                .addExpectedNodeWithOrder("TEL", "18", new TypeSet("X-NEC-FRIEND"))
                .addExpectedNodeWithOrder("TEL", "19", new TypeSet("X-NEC-PHS"))
                .addExpectedNodeWithOrder("TEL", "20", new TypeSet("X-NEC-RESTAURANT"));
    
public voidtestV21PrefToIsPrimary()
Verifies that vCard importer correctly interpret "PREF" attribute to IS_PRIMARY. The data contain three cases: one "PREF", no "PREF" and multiple "PREF", in each type.

        mVerifier.initForImportTest(V21, R.raw.v21_pref_handling);
        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.DISPLAY_NAME, "Smith");
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.NUMBER, "1")
                .put(Phone.TYPE, Phone.TYPE_HOME);
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.NUMBER, "2")
                .put(Phone.TYPE, Phone.TYPE_WORK)
                .put(Phone.IS_PRIMARY, 1);
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.NUMBER, "3")
                .put(Phone.TYPE, Phone.TYPE_ISDN);
        elem.addExpected(Email.CONTENT_ITEM_TYPE)
                .put(Email.DATA, "test@example.com")
                .put(Email.TYPE, Email.TYPE_HOME)
                .put(Email.IS_PRIMARY, 1);
        elem.addExpected(Email.CONTENT_ITEM_TYPE)
                .put(Email.DATA, "test2@examination.com")
                .put(Email.TYPE, Email.TYPE_MOBILE)
                .put(Email.IS_PRIMARY, 1);
        elem.addExpected(Organization.CONTENT_ITEM_TYPE)
                .put(Organization.COMPANY, "Company")
                .put(Organization.TITLE, "Engineer")
                .put(Organization.TYPE, Organization.TYPE_WORK);
        elem.addExpected(Organization.CONTENT_ITEM_TYPE)
                .put(Organization.COMPANY, "Mystery")
                .put(Organization.TITLE, "Blogger")
                .put(Organization.TYPE, Organization.TYPE_WORK);
        elem.addExpected(Organization.CONTENT_ITEM_TYPE)
                .put(Organization.COMPANY, "Poetry")
                .put(Organization.TITLE, "Poet")
                .put(Organization.TYPE, Organization.TYPE_WORK);
    
public voidtestV21SimpleCase1_Parsing()


     
        final int length = sPhotoIntArrayForComplicatedCase.length;
        sPhotoByteArrayForComplicatedCase = new byte[length];
        for (int i = 0; i < length; i++) {
            sPhotoByteArrayForComplicatedCase[i] = (byte)sPhotoIntArrayForComplicatedCase[i];
        }
    
        mVerifier.initForImportTest(V21, R.raw.v21_simple_1);
        mVerifier.addPropertyNodesVerifierElemWithoutVersion()  // no "VERSION:2.1" line.
                .addExpectedNodeWithOrder("N", "Ando;Roid;", Arrays.asList("Ando", "Roid", ""));
    
public voidtestV21SimpleCase1_Type_Generic()

        mVerifier.initForImportTest(VCardConfig.VCARD_TYPE_V21_GENERIC, R.raw.v21_simple_1);
        mVerifier.addContentValuesVerifierElem()
                .addExpected(StructuredName.CONTENT_ITEM_TYPE)
                        .put(StructuredName.FAMILY_NAME, "Ando")
                        .put(StructuredName.GIVEN_NAME, "Roid")
                        .put(StructuredName.DISPLAY_NAME, "Roid Ando");
    
public voidtestV21SimpleCase1_Type_Japanese()

        mVerifier.initForImportTest(VCardConfig.VCARD_TYPE_V21_JAPANESE, R.raw.v21_simple_1);
        mVerifier.addContentValuesVerifierElem()
                .addExpected(StructuredName.CONTENT_ITEM_TYPE)
                        .put(StructuredName.FAMILY_NAME, "Ando")
                        .put(StructuredName.GIVEN_NAME, "Roid")
                        // If name-related strings only contains printable Ascii,
                        // the order is remained to be US's:
                        // "Prefix Given Middle Family Suffix"
                        .put(StructuredName.DISPLAY_NAME, "Roid Ando");
    
public voidtestV21SimpleCase2()

        mVerifier.initForImportTest(VCardConfig.VCARD_TYPE_V21_JAPANESE, R.raw.v21_simple_2);
        mVerifier.addContentValuesVerifierElem()
                .addExpected(StructuredName.CONTENT_ITEM_TYPE)
                        .put(StructuredName.DISPLAY_NAME, "Ando Roid");
    
public voidtestV21SimpleCase3()

        mVerifier.initForImportTest(V21, R.raw.v21_simple_3);
        mVerifier.addContentValuesVerifierElem()
                .addExpected(StructuredName.CONTENT_ITEM_TYPE)
                        .put(StructuredName.FAMILY_NAME, "Ando")
                        .put(StructuredName.GIVEN_NAME, "Roid")
                        // "FN" field should be prefered since it should contain the original
                        // order intended by the author of the file.
                        .put(StructuredName.DISPLAY_NAME, "Ando Roid");
    
public voidtestV21XAndroidCustomAfterPhoto()

        mVerifier.initForImportTest(V21, R.raw.v21_x_android_custom_after_photo);
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("N", "Ando;Roid;", Arrays.asList("Ando", "Roid", ""))
                .addExpectedNodeWithOrder("PHOTO", null,
                        null, sPhotoByteArrayForComplicatedCase, mContentValuesForBase64V21,
                        null, null)
                .addExpectedNodeWithOrder("X-ANDROID-CUSTOM",
                        "vnd.android.cursor.item/contact_event;1999-07-10;1;;;;;;;;;;;;;")
                .addExpectedNodeWithOrder("BDAY", "1975-08-20");
    
public voidtestV30Simple()

        mVerifier.initForImportTest(V30, R.raw.v30_simple);
        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
                .put(StructuredName.FAMILY_NAME, "And")
                .put(StructuredName.GIVEN_NAME, "Roid")
                .put(StructuredName.DISPLAY_NAME, "And Roid")
                .put(StructuredName.PHONETIC_GIVEN_NAME, "android");
        elem.addExpected(Organization.CONTENT_ITEM_TYPE)
                .put(Organization.COMPANY, "Open")
                .put(Organization.DEPARTMENT, "Handset  Alliance")
                .put(Organization.TYPE, Organization.TYPE_WORK);
        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
                .put(Phone.TYPE, Phone.TYPE_OTHER)
                .put(Phone.NUMBER, "030-000-0000")
                .put(Phone.IS_PRIMARY, 1);
    
public voidtestV30Simple_Parsing()

        mVerifier.initForImportTest(V30, R.raw.v30_simple);
        mVerifier.addPropertyNodesVerifierElem()
                .addExpectedNodeWithOrder("FN", "And Roid")
                .addExpectedNodeWithOrder("N", "And;Roid;;;",
                        Arrays.asList("And", "Roid", "", "", ""))
                .addExpectedNodeWithOrder("ORG", "Open;Handset; Alliance",
                        Arrays.asList("Open", "Handset", " Alliance"))
                .addExpectedNodeWithOrder("SORT-STRING", "android")
                .addExpectedNodeWithOrder("TEL", "0300000000", new TypeSet("PREF", "VOICE"))
                .addExpectedNodeWithOrder("CLASS", "PUBLIC")
                .addExpectedNodeWithOrder("X-GNO", "0")
                .addExpectedNodeWithOrder("X-GN", "group0")
                .addExpectedNodeWithOrder("X-REDUCTION", "0")
                .addExpectedNodeWithOrder("REV", "20081031T065854Z");