     }
   }
 
+  private class func verifyElementInArrayExists(strArray: [String], element: String) {
+    let index: Int? = strArray.indexOf(element)
+    XCTAssertNotNil(index, "Array should contain element: \(element)")
+  }
+
  }

  }

  func testGetServices() {
    //TODO
    let options = "{ \"vcap\": { \"services\": { \"cloudantNoSQLDB\": [ { \"name\": \"Cloudant NoSQL DB-kd\", \"label\": \"cloudantNoSQLDB\", \"tags\": [ \"data_management\", \"ibm_created\", \"ibm_dedicated_public\" ], \"plan\": \"Shared\", \"credentials\": { \"username\": \"09ed7c8a-fae8-48ea-affa-0b44b2224ec0-bluemix\", \"password\": \"06c19ae06b1915d8a6649df5901eca85e885182421ffa9ef89e14bbc1b76efd4\", \"host\": \"09ed7c8a-fae8-48ea-affa-0b44b2224ec0-bluemix.cloudant.com\", \"port\": 443, \"url\": \"https://09ed7c8a-fae8-48ea-affa-0b44b2224ec0-bluemix:06c19ae06b1915d8a6649df5901eca85e885182421ffa9ef89e14bbc1b76efd4@09ed7c8a-fae8-48ea-affa-0b44b2224ec0-bluemix.cloudant.com\" } } ] } } }"
    do {
      if let json = Utils.convertStringToJSON(options) {
        print("json \(json)")
        let appEnv = try CFEnvironment.getAppEnv(json)
        let servs = appEnv.services
        print("servs \(servs)")
        let services = appEnv.getServices()
        print("services \(services)")
        XCTAssertEqual(services.count, 1)
        for (name, service) in services {
          XCTAssertEqual(service.name, name, "Key in dictionary and name should match.")
          XCTAssertEqual(service.name, "Cloudant NoSQL DB-kd", "Name should match.")
          XCTAssertEqual(service.label, "cloudantNoSQLDB", "Label should match.")
          XCTAssertEqual(service.plan, "Shared", "Plan should match.")
          let tags = service.tags
          XCTAssertEqual(tags.count, 3)
          XCTAssertEqual(tags[0], "data_management", "Tag #0 should match.")
          XCTAssertEqual(tags[1], "ibm_created", "Tag #1 should match.")
          XCTAssertEqual(tags[2], "ibm_dedicated_public", "Tag #2 should match.")
          let credentials: JSON? = service.credentials
          XCTAssertNotNil(credentials)
          let credentialsStr = credentials!.rawString
          //TODO: Test credentials          
        }
      } else {
        XCTFail("Could not generate JSON object!")

    do {
      if let json = Utils.convertStringToJSON(options) {
        let appEnv = try CFEnvironment.getAppEnv(json)
        //print(appEnv.app)
        let app = appEnv.getApp()
        //print("app: \(app)")
        XCTAssertNotNil(app)
        XCTAssertEqual(app.port, 61263, "Application port number should match.")
        XCTAssertEqual(app.id, "e582416a-9771-453f-8df1-7b467f6d78e4", "Application ID value should match.")
        XCTAssertEqual(app.version, "e5e029d1-4a1a-4004-9f79-655d550183fb", "Application version number should match.")
        XCTAssertEqual(app.name, "swift-test", "App name should match.")
        XCTAssertEqual(app.instanceId, "7d4f24cfba06462ba23d68aaf1d7354a", "Application instance ID value should match.")
        XCTAssertEqual(app.instanceIndex, 0, "Application instance index value should match.")
        XCTAssertEqual(app.spaceId, "b15eb0bb-cbf3-43b6-bfbc-f76d495981e5", "Application space ID value should match.")
        let limits = app.limits
        //print("limits: \(limits)")
        XCTAssertNotNil(limits)
        XCTAssertEqual(limits!.memory, 128, "Memory value should match.")
        XCTAssertEqual(limits!.disk, 1024, "Disk value should match.")
        XCTAssertEqual(limits!.fds, 16384, "FDS value should match.")
        let uris = app.uris
        XCTAssertNotNil(uris)
        XCTAssertEqual(uris!.count, 1, "There should be only 1 uri in the uris array.")
        XCTAssertEqual(uris![0], "swift-test.mybluemix.net", "URI value should match.")
        XCTAssertEqual(app.name, "swift-test", "Application name should match.")
        let startedAt: NSDate? = app.startedAt
        XCTAssertNotNil(startedAt)
        let dateUtils = DateUtils()
        let startedAtStr = dateUtils.convertNSDateToString(startedAt)
        XCTAssertEqual(startedAtStr, "2016-03-04 02:43:07 +0000", "Application startedAt date should match.")
        XCTAssertNotNil(app.startedAtTs, "Application startedAt ts should not be nil.")
        XCTAssertEqual(app.startedAtTs, 1457059387, "Application startedAt ts should match.")
      } else {
        XCTFail("Could not generate JSON object!")
      }
