Package net.sourceforge.cardme.vcard

Examples of net.sourceforge.cardme.vcard.VCard


    vcard.addAllExtendedTypes(null);
  }
 
  @Test
  public void testEquals() throws Exception {
    VCard vcardCopy = getFullVCardNoErrors();
    assertEquals(vcardCopy, vcardFull);
  }
View Full Code Here


    assertEquals(vcardCopy, vcardFull);
  }
 
  @Test
  public void testHashcode() throws Exception {
    VCard vcardCopy = getFullVCardNoErrors();
   
    int h1 = vcardFull.hashCode();
    int h2 = vcardCopy.hashCode();
   
    assertEquals(h1, h2);
  }
View Full Code Here

    assertEquals(h1, h2);
  }
 
  @Test
  public void testClone() {
    VCard cloned = vcardFull.clone();
    assertEquals(vcardFull, cloned);
  }
View Full Code Here

    assertNotNull(vcardString);
    assertFalse(vcardWriter.hasErrors());
   
    VCardEngine vcardEngine = new VCardEngine();
    vcardEngine.setCompatibilityMode(CompatibilityMode.RFC2426);
    VCard _vcard = vcardEngine.parse(vcardString);
   
    assertNotNull(_vcard);
    assertFalse(((VCardErrorHandler)_vcard).hasErrors());
   
    //TODO the below tests fail.
View Full Code Here

    assertFalse(vcardWriter.hasErrors());
    assertTrue("Got " + vcardString, (vcardString.indexOf("D=C3=96e") != -1));
   
    VCardEngine vcardEngine = new VCardEngine();
    vcardEngine.setCompatibilityMode(CompatibilityMode.RFC2426);
    VCard _vcard = vcardEngine.parse(vcardString);
   
    assertEquals("DÖe", _vcard.getN().getFamilyName());
  }
View Full Code Here

  public void testUnfoldingSpaceBug() throws VCardBuildException, IOException, VCardParseException {
   
    /* This string will work just fine as the fold is in the middle of a word */
    final String correctNote = "Lines seem to be unfolded correctly if spaces aren't exactly on a folding boundary.";
   
    VCard vcard = new VCardImpl();
    vcard.setVersion(new VersionType(VCardVersion.V3_0));
    vcard.setName(new NameType("Some Name"));
    vcard.addNote(new NoteType(correctNote));

    VCardWriter writer = new VCardWriter();
    writer.setVCard(vcard);
    String vcardString = writer.buildVCardString();
   
    VCardEngine vcardEngine = new VCardEngine(CompatibilityMode.RFC2426);
    VCard parsedVcard = vcardEngine.parse(vcardString);
   
    assertNotNull(parsedVcard);
    assertTrue(parsedVcard.hasNotes());
    assertTrue(parsedVcard.getNotes().size() == 1);

    String parsedNote = parsedVcard.getNotes().get(0).getNote();
    assertEquals(correctNote, parsedNote);
   
    //------------------------------------------------------
   
    /* This string has the fold right at a space and the space is lost when retrieving it later */
    final String incorrectNote = "Lines seem to be unfolded incorrectly if spaces are just exactly on a folding boundary.";
   
    vcard = new VCardImpl();
    vcard.setVersion(new VersionType(VCardVersion.V3_0));
    vcard.setName(new NameType("Some Name"));
    vcard.addNote(new NoteType(incorrectNote));

    writer = new VCardWriter();
    writer.setVCard(vcard);
    vcardString = writer.buildVCardString();
   
    vcardEngine = new VCardEngine(CompatibilityMode.RFC2426);
    parsedVcard = vcardEngine.parse(vcardString);
   
    assertNotNull(parsedVcard);
    assertTrue(parsedVcard.hasNotes());
    assertTrue(parsedVcard.getNotes().size() == 1);

    parsedNote = parsedVcard.getNotes().get(0).getNote();
    assertEquals(incorrectNote, parsedNote);
  }
View Full Code Here

    assertEquals(VCardTypeName.AGENT.getType(), agentType.getVCardTypeName().getType());
  }
 
  @Test
  public void testEquals() {
    VCard agentVCard2 = new VCardImpl();
    agentVCard2.setN(new NType("Doe", "John"));
    agentVCard2.setFN(new FNType("John Doe"));
   
    AgentType agentType2 = new AgentType();
    agentType2.setAgent(agentVCard2);
   
    assertTrue(agentType.equals(agentType2));
View Full Code Here

    assertTrue(agentType.equals(agentType2));
  }
 
  @Test
  public void testHashcode() {
    VCard agentVCard2 = new VCardImpl();
    agentVCard2.setN(new NType("Doe", "John"));
    agentVCard2.setFN(new FNType("John Doe"));
   
    AgentType agentType2 = new AgentType();
    agentType2.setAgent(agentVCard2);
   
    int hcode1 = agentType.hashCode();
View Full Code Here

    assertEquals(hcode1, hcode2);
  }
 
  @Test
  public void testCompareTo() {
    VCard agentVCard2 = new VCardImpl();
    agentVCard2.setN(new NType("Doe", "John"));
    agentVCard2.setFN(new FNType("John Doe"));
   
    AgentType agentType2 = new AgentType();
    agentType2.setAgent(agentVCard2);
   
    assertTrue(agentType.compareTo(agentType2) == 0);
View Full Code Here

            tmpSb.append("VALUE=URI:");
            tmpSb.append(agentType.getAgentURI().getPath());
          }
          else if(EncodingType.BINARY.equals(agentType.getEncodingType())) {
            tmpSb.append(":");
            VCard agentVCard = agentType.getAgent();
            if(agentVCard instanceof VCardErrorHandler) {
              //Turn on error handling if available
              ((VCardErrorHandler)agentVCard).setThrowExceptions(true);
            }
           
View Full Code Here

TOP

Related Classes of net.sourceforge.cardme.vcard.VCard

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.