Search in sources :

Example 21 with RawProperty

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

the class VCardTest method getProperties.

@Test
public void getProperties() {
    VCard vcard = new VCard();
    assertCollectionContains(vcard.getProperties());
    assertEquals(asList(), vcard.getProperties(Note.class));
    assertEquals(asList(), vcard.getProperties(RawProperty.class));
    Note property1 = new Note("value");
    vcard.addProperty(property1);
    assertCollectionContains(vcard.getProperties(), property1);
    assertEquals(asList(property1), vcard.getProperties(Note.class));
    assertEquals(asList(), vcard.getProperties(RawProperty.class));
    RawProperty property2 = vcard.addExtendedProperty("X-GENDER", "male");
    RawProperty property3 = vcard.addExtendedProperty("X-MANAGER", "Michael Scott");
    assertCollectionContains(vcard.getProperties(), property1, property2, property3);
    assertEquals(asList(property1), vcard.getProperties(Note.class));
    assertEquals(asList(property2, property3), vcard.getProperties(RawProperty.class));
}
Also used : RawProperty(ezvcard.property.RawProperty) Note(ezvcard.property.Note) Test(org.junit.Test)

Example 22 with RawProperty

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

the class VCardTest method removeExtendedProperty.

@Test
public void removeExtendedProperty() {
    VCard vcard = new VCard();
    assertEquals(asList(), vcard.removeExtendedProperty("NAME"));
    assertEquals(asList(), vcard.getExtendedProperties());
    RawProperty property = vcard.addExtendedProperty("NAME", "value");
    RawProperty property2 = vcard.addExtendedProperty("NAME", "value2");
    RawProperty property3 = vcard.addExtendedProperty("NAME2", "value");
    assertEquals(asList(property, property2, property3), vcard.getExtendedProperties());
    assertEquals(asList(property, property2), vcard.removeExtendedProperty("NAME"));
    assertEquals(asList(property3), vcard.getExtendedProperties());
}
Also used : RawProperty(ezvcard.property.RawProperty) Test(org.junit.Test)

Aggregations

RawProperty (ezvcard.property.RawProperty)22 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)4 VCard (ezvcard.VCard)3 VCardVersion (ezvcard.VCardVersion)3 FormattedName (ezvcard.property.FormattedName)3 Impp (ezvcard.property.Impp)3 VCardProperty (ezvcard.property.VCardProperty)3 LuckyNumProperty (ezvcard.io.LuckyNumProperty)2 LuckyNumScribe (ezvcard.io.LuckyNumProperty.LuckyNumScribe)2 Label (ezvcard.property.Label)2 ProductId (ezvcard.property.ProductId)2 StructuredName (ezvcard.property.StructuredName)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 VCardDataType (ezvcard.VCardDataType)1 AgeProperty (ezvcard.io.AgeProperty)1 AgeScribe (ezvcard.io.AgeProperty.AgeScribe)1 CannotParseException (ezvcard.io.CannotParseException)1