Search in sources :

Example 41 with VCardAsserter

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

the class XCardReaderTest method read_ignore_other_namespaces.

@Test
public void read_ignore_other_namespaces() throws Exception {
    // @formatter:off
    VCardAsserter asserter = readXml("<root>" + "<ignore xmlns=\"one\" />" + "<vcards xmlns=\"" + V4_0.getXmlNamespace() + "\">" + "<ignore xmlns=\"two\">text</ignore>" + "<vcard>" + "<fn>" + "<parameters>" + "<ignore xmlns=\"three\"><foo>bar</foo></ignore>" + "<pref><ignore xmlns=\"four\">bar</ignore><integer>1</integer></pref>" + "<pref><integer>2</integer></pref>" + "</parameters>" + "<text>Dr. Gregory House M.D.</text>" + "</fn>" + "</vcard>" + "</vcards>" + "</root>");
    asserter.next(V4_0);
    asserter.simpleProperty(FormattedName.class).value("Dr. Gregory House M.D.").param("PREF", "1").param("PREF", "2").noMore();
    asserter.done();
// @formatter:on
}
Also used : VCardAsserter(ezvcard.property.asserter.VCardAsserter) Test(org.junit.Test)

Example 42 with VCardAsserter

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

the class XCardReaderTest method read_empty.

@Test
public void read_empty() throws Exception {
    VCardAsserter asserter = readXml("<vcards xmlns=\"" + V4_0.getXmlNamespace() + "\" />");
    asserter.done();
}
Also used : VCardAsserter(ezvcard.property.asserter.VCardAsserter) Test(org.junit.Test)

Example 43 with VCardAsserter

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

the class XCardReaderTest method read_xml_property.

@Test
public void read_xml_property() throws Exception {
    // @formatter:off
    VCardAsserter asserter = readXml("<vcards xmlns=\"" + V4_0.getXmlNamespace() + "\">" + "<vcard>" + "<x:foo xmlns:x=\"http://example.com\">" + "<parameters>" + "<pref><integer>1</integer></pref>" + "</parameters>" + "<!-- comment -->" + "<x:a />" + "<x:b attr=\"value\">text</x:b>" + "<x:c>text<x:child>child</x:child></x:c>" + "</x:foo>" + "</vcard>" + "</vcards>");
    asserter.next(V4_0);
    asserter.xml().param("PREF", "1").value("<foo xmlns=\"http://example.com\">" + "<a />" + "<b attr=\"value\">text</b>" + "<c>text<child>child</child></c>" + "</foo>").noMore();
    asserter.done();
// @formatter:off
}
Also used : VCardAsserter(ezvcard.property.asserter.VCardAsserter) Test(org.junit.Test)

Example 44 with VCardAsserter

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

the class XCardReaderTest method read_single.

@Test
public void read_single() throws Exception {
    // @formatter:off
    VCardAsserter asserter = readXml("<!-- ignore -->" + "<vcards xmlns=\"" + V4_0.getXmlNamespace() + "\">" + "<vcard>" + "<fn><text>Dr. Gregory House M.D.</text></fn>" + "<n>" + "<surname>House</surname>" + "<given>Gregory</given>" + "<!-- ignore -->" + "<additional />" + "<prefix>Dr</prefix>" + "<prefix>Mr</prefix>" + "<suffix>MD</suffix>" + "</n>" + "</vcard>" + "</vcards>");
    asserter.next(V4_0);
    asserter.simpleProperty(FormattedName.class).value("Dr. Gregory House M.D.").noMore();
    asserter.structuredName().family("House").given("Gregory").prefixes("Dr", "Mr").suffixes("MD").noMore();
    asserter.done();
// @formatter:on
}
Also used : VCardAsserter(ezvcard.property.asserter.VCardAsserter) Test(org.junit.Test)

Example 45 with VCardAsserter

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

the class XCardReaderTest method read_wrong_namespace.

@Test
public void read_wrong_namespace() throws Exception {
    // @formatter:off
    VCardAsserter asserter = readXml("<vcards xmlns=\"wrong\">" + "<vcard>" + "<fn><text>Dr. Gregory House M.D.</text></fn>" + "</vcard>" + "</vcards>");
    // @formatter:on
    asserter.done();
}
Also used : 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