home | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Lift Framework example source code file (VCardParserSpec.scala)

This example Lift Framework source code file (VCardParserSpec.scala) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Lift Framework tags/keywords

co, gump, gump, list, list, man, shrimp, specification, tel, vcard, vcard, vcardentry, vcardentry, voice

The Lift Framework VCardParserSpec.scala source code

 * Copyright 2008-2011 WorldWide Conferencing, LLC
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *     http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.

package net.liftweb
package util

import org.specs.Specification

 * Systems under specification for VCardParser.
object VCardParserSpec extends Specification("VCardParser Specification") {

  "VCard" should {
    "parse correctly" in {

    val vcard =
        |FN:Forrest Gump
        |ORG:Bubba Gump Shrimp Co.
        |TITLE:Shrimp Man
        |TEL;WORK;VOICE:(111) 555-1212
        |TEL;HOME;VOICE:(404) 555-1212

      val list = VCardParser.parse(vcard)
      list match {
        case Left(l)  => {
          import VCardParser._
          l must_==
              VCardEntry(VCardKey("BEGIN", List()), List("VCARD")),
              VCardEntry(VCardKey("VERSION", List()), List("2.1")),
              VCardEntry(VCardKey("N", List()), List("Gump", "Forrest")),
              VCardEntry(VCardKey("FN", List()), List("Forrest Gump")),
              VCardEntry(VCardKey("ORG", List()), List("Bubba Gump Shrimp Co.")),
              VCardEntry(VCardKey("TITLE", List()), List("Shrimp Man")),
              VCardEntry(VCardKey("TEL", List(("WORK", ""), ("VOICE", ""))), List("(111) 555-1212")),
              VCardEntry(VCardKey("TEL", List(("HOME", ""), ("VOICE", ""))), List("(404) 555-1212")),
              VCardEntry(VCardKey("END", List()), List("VCARD")))
        case Right(r) => fail(r toString)



Other Lift Framework examples (source code examples)

Here is a short list of links related to this Lift Framework VCardParserSpec.scala source code file:

my book on functional programming


new blog posts


Copyright 1998-2019 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.