         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.")
-
-
-
-        let services = appEnv.getServices()
-        //print("services \(services)")
-        XCTAssertEqual(services.count, 1, "There should be only 1 service in the services dictionary.")
-        let name = "Cloudant NoSQL DB-kd"
-        if let service = services[name] {
-          XCTAssertEqual(service.name, name, "Key in dictionary and service name should match.")
-          verifyService(service: service)
-        } else {
-          XCTFail("A service object should have been found for '\(name)'.")
-        }
       } else {
         XCTFail("Could not get App object!")
       }

    super.tearDown()
    jsonOptions = [:]
  }

  func testGetApp2() {
    let filePath = URL(fileURLWithPath: #file).appendingPathComponent("../resources/config-non-default.json").standardized
    let configData = try! Data(contentsOf: filePath)
    let json = try! JSONSerialization.jsonObject(with: configData, options: []) as! [String:Any]
    print("json: \(json)")


    let manager = ConfigurationManager()
    do {
      try manager.loadFile(filePath.path)
      let servs = manager["VCAP_SERVICES"]
      print("servs: \(servs)")
      let app = manager["VCAP_APPLICATION"] as? [String:Any]
      let name = manager["VCAP_APPLICATION:name"]
      let namee = app!["name"]// as? String
      print("name2: \(namee)")
      print("name: \(name)")
      print("app: \(app)")
      var vcap: [String:Any] = [:]
      vcap["application"] = app
      vcap["services"] = servs
      var config: [String:Any] = [:]
      config["vcap"] = vcap
      print("config: \(config)")
      let appEnv = try CloudFoundryEnv.getAppEnv(options: config)
      if let app = appEnv.getApp() {
        print("OK.....")
        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: Date? = app.startedAt
        XCTAssertNotNil(startedAt)
        let dateUtils = DateUtils()
        let startedAtStr = dateUtils.convertNSDateToString(nsDate: 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 get App object!")
      }
    } catch let error as NSError {
      Log.error("Error domain: \(error.domain)")
      Log.error("Error code: \(error.code)")
      XCTFail("Could not get AppEnv object!")
    }
  }

  func testGetApp() {
    do {
      print("jsonOptions: \(jsonOptions)")
      let appEnv = try CloudFoundryEnv.getAppEnv(options: jsonOptions)
      if let app = appEnv.getApp() {
        XCTAssertNotNil(app)

      } else {
        XCTFail("A service object should have been found for '\(name)'.")
      }
    } catch let error as NSError {
      Log.error("Error domain: \(error.domain)")
      Log.error("Error code: \(error.code)")
      XCTFail("Could not get AppEnv object!")
    }
  }

  func testGetServicesByType() {
    do {
      let appEnv = try CloudFoundryEnv.getAppEnv(options: jsonOptions)
      var services: [Service] = appEnv.getServices(type: "cloudantNoSQLDB")
      XCTAssertEqual(services.count, 1, "There should be only 1 service in the services array.")
      verifyService(service: services[0])
      services = appEnv.getServices(type: "invalidType")
      XCTAssertEqual(services.count, 0, "There should be 0 items in the services array.")
    } catch let error as NSError {
      Log.error("Error domain: \(error.domain)")
      Log.error("Error code: \(error.code)")
