/** * If properties contain "PREF" parameters and they're being marshalled to 2.1/3.0, then it should * find the type with the lowest PREF value and add "TYPE=pref" to it. */ @Test public void prepareParameters_pref_parameter() { // TODO move this test to VCardPropertyScribeTest (except for the "label" part) VCard vcard = new VCard(); Address adr2 = new Address(); adr2.setPref(2); vcard.addAddress(adr2); Address adr1 = new Address(); adr1.setPref(1); vcard.addAddress(adr1); Address adr3 = new Address(); vcard.addAddress(adr3); // 2.1 and 3.0 converts the lowest PREF parameter to "TYPE=pref", and removes all the rest sensei .assertPrepareParams(adr1) .versions(V2_1, V3_0) .vcard(vcard) .expected("TYPE", "pref") .run(); sensei.assertPrepareParams(adr2).versions(V2_1, V3_0).vcard(vcard).run(); sensei.assertPrepareParams(adr3).versions(V2_1, V3_0).vcard(vcard).run(); // 4.0 keeps it sensei.assertPrepareParams(adr1).versions(V4_0).vcard(vcard).expected("PREF", "1").run(); sensei.assertPrepareParams(adr2).versions(V4_0).vcard(vcard).expected("PREF", "2").run(); sensei.assertPrepareParams(adr3).versions(V4_0).vcard(vcard).run(); }
/** * If a property contains a "TYPE=pref" parameter and it's being marshalled to 4.0, it should * replace "TYPE=pref" with "PREF=1". */ @Test public void prepareParameters_type_pref() { Address property = new Address(); property.addType(AddressType.PREF); // 2.1 and 3.0 keep it sensei.assertPrepareParams(property).versions(V2_1, V3_0).expected("TYPE", "pref").run(); // 4.0 converts it to "PREF=1" sensei.assertPrepareParams(property).versions(V4_0).expected("PREF", "1").run(); }
@Test public void prepareParameters_label() { Address property = new Address(); property.setLabel("label"); // 2.1 and 3.0 should remove it sensei.assertPrepareParams(property).versions(V2_1, V3_0).run(); // 4.0 should keep it sensei.assertPrepareParams(property).versions(V4_0).expected("LABEL", "label").run(); }
{ withSomeFields.setPoBox("P.O. Box 1234;"); withSomeFields.setExtendedAddress(null); withSomeFields.setStreetAddress(null); withSomeFields.setLocality("Austin"); withSomeFields.setRegion("TX"); withSomeFields.setPostalCode("12345"); withSomeFields.setCountry(null); }
{ withAllFields.setPoBox("P.O. Box 1234;"); withAllFields.setExtendedAddress("Apt, 11"); withAllFields.setStreetAddress("123 Main St"); withAllFields.setLocality("Austin"); withAllFields.setRegion("TX"); withAllFields.setPostalCode("12345"); withAllFields.setCountry("USA"); }