Package net.sourceforge.cardme.vcard.features

Examples of net.sourceforge.cardme.vcard.features.NoteFeature


    assertTrue(noteType.compareTo(noteType2) == 0);
  }
 
  @Test
  public void testClone() {
    NoteFeature cloned = noteType.clone();
    assertEquals(cloned, noteType);
    assertTrue(noteType.equals(cloned));
  }
View Full Code Here


   
    //NOTE
    {
      List<NoteType> it = vcard.getNotes();
      assertEquals(1, it.size());
      NoteFeature f = it.get(0);
      assertEquals("THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", f.getNote());
    }
   
    //EMAIL
    {
      List<EmailType> it = vcard.getEmails();
      assertEquals(1, it.size());
     
      EmailType f = it.get(0);
      assertEquals("john.doe@ibm.com", f.getEmail());
     
      List<EmailParamType> types = f.getParams();
      assertEquals(1, types.size());
      assertTrue(types.contains(EmailParamType.WORK));
     
      List<ExtendedParamType> xlist = f.getExtendedParams();
      assertEquals(1, xlist.size());
      assertEquals("X-COUCHDB-UUID", xlist.get(0).getTypeName());
      assertEquals("83a75a5d-2777-45aa-bab5-76a4bd972490".toUpperCase(), xlist.get(0).getTypeValue());
    }
   
    //ADR
    {
      List<AdrType> it = vcard.getAdrs();
      assertEquals(1, it.size());
     
      AdrType f = it.get(0);
      assertEquals("ASB-123", f.getPostOfficeBox());
      assertEquals("", f.getExtendedAddress());
      assertEquals("15 Crescent moon drive", f.getStreetAddress());
      assertEquals("Albaney", f.getLocality());
      assertEquals("New York", f.getRegion());
      assertEquals("12345", f.getPostalCode());
     
      /*
       * This would fail under normal circumstances because Evolution
       * assumes that only the first white-space character is discarded
       * as part of the folding and that the rest are preserved. If every
       * application followed the RFC standard then that would be so, but
       * it is not.
       */
      assertEquals("United States of America", f.getCountryName());
     
      List<AdrParamType> types = f.getParams();
      assertEquals(1, types.size());
      assertTrue(types.contains(AdrParamType.HOME));
    }
   
    //BDAY
    {
      BDayType f = vcard.getBDay();
      assertEquals(1980, f.getBirthday().get(Calendar.YEAR));
      assertEquals(Calendar.MARCH, f.getBirthday().get(Calendar.MONTH));
      assertEquals(22, f.getBirthday().get(Calendar.DAY_OF_MONTH));
    }
   
    //REV
    {
      RevType f = vcard.getRev();
      Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
      c.clear();
      c.set(Calendar.YEAR, 2012);
      c.set(Calendar.MONTH, Calendar.MARCH);
      c.set(Calendar.DAY_OF_MONTH, 5);
      c.set(Calendar.HOUR_OF_DAY, 13);
      c.set(Calendar.MINUTE, 32);
      c.set(Calendar.SECOND, 54);
      Calendar actual = f.getRevision();
      assertEquals(c.getTime(), actual.getTime());
    }
   
    //custom types
    {
      List<ExtendedType> it = vcard.getExtendedTypes();
      assertEquals(7, it.size());
     
      ExtendedType f = it.get(0);
      assertEquals("X-COUCHDB-APPLICATION-ANNOTATIONS", f.getExtendedName());
      assertEquals("{\"Evolution\":{\"revision\":\"2012-03-05T13:32:54Z\"}}", f.getExtendedValue());
     
      f = it.get(1);
      assertEquals("X-AIM", f.getExtendedName());
      assertEquals("johnny5@aol.com", f.getExtendedValue());
     
      List<ExtendedParamType> xParamTypes = f.getExtendedParams();
      assertEquals(2, xParamTypes.size());
     
      ExtendedParamType xParamType = xParamTypes.get(0);
      assertEquals("TYPE", xParamType.getTypeName());
      assertEquals("HOME", xParamType.getTypeValue());
     
      xParamType = xParamTypes.get(1);
      assertEquals("X-COUCHDB-UUID",xParamType.getTypeName());
      assertEquals("cb9e11fc-bb97-4222-9cd8-99820c1de454".toUpperCase(), xParamType.getTypeValue());
     
      f = it.get(2);
      assertEquals("X-EVOLUTION-FILE-AS", f.getExtendedName());
      assertEquals("Doe, John", f.getExtendedValue());
     
      f = it.get(3);
      assertEquals("X-EVOLUTION-SPOUSE", f.getExtendedName());
      assertEquals("Maria", f.getExtendedValue());

      f = it.get(4);
      assertEquals("X-EVOLUTION-MANAGER", f.getExtendedName());
      assertEquals("Big Blue", f.getExtendedValue());
     
      f = it.get(5);
      assertEquals("X-EVOLUTION-ASSISTANT", f.getExtendedName());
      assertEquals("Little Red", f.getExtendedValue());
     
      f = it.get(6);
      assertEquals("X-EVOLUTION-ANNIVERSARY", f.getExtendedName());
      assertEquals("1980-03-22", f.getExtendedValue());
    }
   
    VCardImpl vcard2 = (VCardImpl)vcard;
   
    if(vcard2.hasErrors()) {
View Full Code Here

TOP

Related Classes of net.sourceforge.cardme.vcard.features.NoteFeature

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.