use of ezvcard.property.Agent in project ez-vcard by mangstadt.
the class VCardWriterTest method setVersionStrict_embedded.
@Test
public void setVersionStrict_embedded() throws Throwable {
VCard vcard = new VCard();
VCard agentVCard = new VCard();
// only supported by 4.0
agentVCard.setGender(Gender.male());
Agent agent = new Agent(agentVCard);
vcard.setAgent(agent);
StringWriter sw = new StringWriter();
VCardWriter vcw = new VCardWriter(sw, VCardVersion.V3_0);
vcw.setAddProdId(false);
vcw.setVersionStrict(false);
vcw.write(vcard);
String actual = sw.toString();
// @formatter:off
String expected = "BEGIN:VCARD\r\n" + "VERSION:3.0\r\n" + "AGENT:BEGIN:VCARD\\nVERSION:3.0\\nGENDER:M\\nEND:VCARD\\n\r\n" + "END:VCARD\r\n";
// @formatter:on
assertEquals(actual, expected);
}
Aggregations