VCardBean extends AbstractEntity { public static VCardBean parse(Reader r, String charset) { return BEANS.get(ICalVCardHelper.class).parse(r, charset, BEANS.get(VCardBean.class)); }  static VCardBean parse(Reader r, String charset); void write(Writer w, String charset); byte[] toBytes(String charset);  }
@Test public void testParse() { final String vcard = "BEGIN:VCARD\r\n" + "VERSION:3.0\r\n" + "PRODID:PRODID\r\n" + "FN:John Doe\r\n" + "N:Doe;John;Hannes;Dr.;\r\n" + "TEL;TYPE=VOICE,WORK:0998887766\r\n" + "TITLE:Software Engineer\r\n" + "EMAIL;TYPE=WORK:john.doe@email.com\r\n" + "ORG:Doe Corporation\r\n" + "ADR;TYPE=HOME:;;Bahnhofweg;Zurich;;8000;Switzerland\r\n" + "END:VCARD\r\n"; ICalBean bean = ICalBean.parse(new StringReader(vcard), "utf-8"); assertNotNull(bean.getProperty(VCardProperties.PROP_NAME_BEGIN)); assertNotNull(bean.getProperty(VCardProperties.PROP_NAME_VERSION)); assertNotNull(bean.getProperty(VCardProperties.PROP_NAME_PRODID)); assertNotNull(bean.getProperty(VCardProperties.PROP_NAME_FN)); assertNotNull(bean.getProperty(VCardProperties.PROP_NAME_N)); assertNotNull(bean.getProperty(VCardProperties.PROP_NAME_TEL)); assertNotNull(bean.getProperty(VCardProperties.PROP_NAME_TITLE)); assertNotNull(bean.getProperty(VCardProperties.PROP_NAME_EMAIL)); assertNotNull(bean.getProperty(VCardProperties.PROP_NAME_ORG)); assertNotNull(bean.getProperty(VCardProperties.PROP_NAME_ADR)); assertNotNull(bean.getProperty(VCardProperties.PROP_NAME_END)); assertEquals(VCardProperties.PROP_VALUE_VCARD, bean.getProperty(VCardProperties.PROP_NAME_BEGIN).getValue()); assertEquals(VCardProperties.PROP_VALUE_VERSION_3_0, bean.getProperty(VCardProperties.PROP_NAME_VERSION).getValue()); assertEquals("PRODID", bean.getProperty(VCardProperties.PROP_NAME_PRODID).getValue()); assertEquals("John Doe", bean.getProperty(VCardProperties.PROP_NAME_FN).getValue()); assertEquals("Doe;John;Hannes;Dr.;", bean.getProperty(VCardProperties.PROP_NAME_N).getValue()); assertEquals("0998887766", bean.getProperty(VCardProperties.PROP_NAME_TEL).getValue()); assertTrue(bean.getProperty(VCardProperties.PROP_NAME_TEL).hasParameter(VCardProperties.PARAM_NAME_TYPE)); assertEquals(VCardProperties.PARAM_VALUE_VOICE + "," + VCardProperties.PARAM_VALUE_WORK, bean.getProperty(VCardProperties.PROP_NAME_TEL).getParameter(VCardProperties.PARAM_NAME_TYPE).getValue()); assertEquals("Software Engineer", bean.getProperty(VCardProperties.PROP_NAME_TITLE).getValue()); assertEquals("john.doe@email.com", bean.getProperty(VCardProperties.PROP_NAME_EMAIL).getValue()); assertTrue(bean.getProperty(VCardProperties.PROP_NAME_EMAIL).hasParameter(VCardProperties.PARAM_NAME_TYPE)); assertEquals(VCardProperties.PARAM_VALUE_WORK, bean.getProperty(VCardProperties.PROP_NAME_EMAIL).getParameter(VCardProperties.PARAM_NAME_TYPE).getValue()); assertTrue(bean.getProperty(VCardProperties.PROP_NAME_EMAIL).hasParameter(VCardProperties.PARAM_NAME_TYPE)); assertEquals("Doe Corporation", bean.getProperty(VCardProperties.PROP_NAME_ORG).getValue()); assertEquals(";;Bahnhofweg;Zurich;;8000;Switzerland", bean.getProperty(VCardProperties.PROP_NAME_ADR).getValue()); assertTrue(bean.getProperty(VCardProperties.PROP_NAME_ADR).hasParameter(VCardProperties.PARAM_NAME_TYPE)); assertEquals(VCardProperties.PARAM_VALUE_HOME, bean.getProperty(VCardProperties.PROP_NAME_ADR).getParameter(VCardProperties.PARAM_NAME_TYPE).getValue()); assertEquals(VCardProperties.PROP_VALUE_VCARD, bean.getProperty(VCardProperties.PROP_NAME_END).getValue()); }