Search in sources :

Example 86 with VCardAsserter

use of ezvcard.property.asserter.VCardAsserter in project ez-vcard by mangstadt.

the class XCardReaderTest method read_parameters.

@Test
public void read_parameters() throws Exception {
    // @formatter:off
    VCardAsserter asserter = readXml("<vcards xmlns=\"" + V4_0.getXmlNamespace() + "\">" + "<vcard>" + // zero params
    "<note>" + "<text>Note 1</text>" + "</note>" + // one param
    "<note>" + "<parameters>" + "<altid><text>1</text></altid>" + "</parameters>" + "<text>Hello world!</text>" + "</note>" + // one param, but doesn't have a value element, so it should be ignored
    "<note>" + "<parameters>" + "<altid>1</altid>" + "</parameters>" + "<text>Hallo Welt!</text>" + "</note>" + // two params
    "<note>" + "<parameters>" + "<altid><text>1</text></altid>" + "<language><language-tag>fr</language-tag></language>" + "</parameters>" + "<text>Bonjour tout le monde!</text>" + "</note>" + // a param with multiple values
    "<tel>" + "<parameters>" + "<type>" + "<text>work</text>" + "<text>voice</text>" + "</type>" + "</parameters>" + "<uri>tel:+1-555-555-1234</uri>" + "</tel>" + "</vcard>" + "</vcards>");
    asserter.next(V4_0);
    asserter.simpleProperty(Note.class).value("Note 1").next().value("Hello world!").param("ALTID", "1").next().value("Hallo Welt!").next().value("Bonjour tout le monde!").param("ALTID", "1").param("LANGUAGE", "fr").noMore();
    asserter.telephone().uri(new TelUri.Builder("+1-555-555-1234").build()).types(TelephoneType.WORK, TelephoneType.VOICE).noMore();
    asserter.done();
// @formatter:on
}
Also used : Note(ezvcard.property.Note) VCardAsserter(ezvcard.property.asserter.VCardAsserter) Test(org.junit.Test)

Aggregations

VCardAsserter (ezvcard.property.asserter.VCardAsserter)86 Test (org.junit.Test)84 Url (ezvcard.property.Url)12 VCard (ezvcard.VCard)10 VCardVersion (ezvcard.VCardVersion)10 FreeBusyUrl (ezvcard.property.FreeBusyUrl)9 Note (ezvcard.property.Note)7 Organization (ezvcard.property.Organization)7 Photo (ezvcard.property.Photo)7 FormattedName (ezvcard.property.FormattedName)6 Key (ezvcard.property.Key)6 UtcOffset (ezvcard.util.UtcOffset)5 CannotParseScribe (ezvcard.io.scribe.CannotParseScribe)4 SkipMeScribe (ezvcard.io.scribe.SkipMeScribe)4 TelUri (ezvcard.util.TelUri)4 Label (ezvcard.property.Label)3 StreamReader (ezvcard.io.StreamReader)2 Categories (ezvcard.property.Categories)2 Utf8Writer (ezvcard.util.Utf8Writer)2 File (java.io.File)2