Search in sources :

Example 6 with JCardValue

use of ezvcard.io.json.JCardValue in project ez-vcard by mangstadt.

the class RawPropertyScribeTest method parseJson.

@Test
public void parseJson() {
    JCardValue value = JCardValue.single("one\\,two");
    sensei.assertParseJson(value).dataType(VCardDataType.TEXT).run(has("RAW", "one\\,two", VCardDataType.TEXT));
    value = JCardValue.multi("one", "two,three");
    sensei.assertParseJson(value).dataType(VCardDataType.TEXT).run(has("RAW", "one,two\\,three", VCardDataType.TEXT));
    value = JCardValue.structured(Arrays.asList("one", "two"), Arrays.asList("three,four"));
    sensei.assertParseJson(value).dataType(VCardDataType.TEXT).run(has("RAW", "one,two;three\\,four", VCardDataType.TEXT));
}
Also used : JCardValue(ezvcard.io.json.JCardValue) Test(org.junit.Test)

Example 7 with JCardValue

use of ezvcard.io.json.JCardValue in project ez-vcard by mangstadt.

the class VCardPropertyScribeTest method parseJson_single.

@Test
public void parseJson_single() {
    final VCardParameters params = new VCardParameters();
    JCardValue value = JCardValue.single("value");
    sensei.assertParseJson(value).dataType(VCardDataType.TEXT).params(params).warnings((Integer) null).run(new Check<TestProperty>() {

        public void check(TestProperty property) {
            assertEquals("value", property.value);
            assertSame(params, property.getParameters());
        }
    });
}
Also used : VCardParameters(ezvcard.parameter.VCardParameters) JCardValue(ezvcard.io.json.JCardValue) Test(org.junit.Test)

Aggregations

JCardValue (ezvcard.io.json.JCardValue)7 Test (org.junit.Test)7 VCardParameters (ezvcard.parameter.VCardParameters)1 Address (ezvcard.property.Address)1