   }
 
   func sendForTesting(fn: @escaping (Data) -> Void ) {
-    let dataTask = URLSession(configuration: .default).dataTask(with: self) {
-      data, response, error in
+    let dataTask = URLSession(configuration: .default).dataTask(with: self) { data, response, error in
       XCTAssertNil(error)
       XCTAssertNotNil(data)
       switch (response as? HTTPURLResponse)?.statusCode {
         case nil: XCTFail("bad response")
-        case 200?: fn(data!)
+        case 200?:
+          XCTAssertNotNil(data, "Data from endpoint is nil.")
+          fn(data!)
         case let sc?: XCTFail("bad status \(sc)")
       }
     }

        let images = JSON(data: data)
        let records = images["records"].arrayValue
        XCTAssertEqual(records.count, 3)
        let image = records.first!
        self.assertImage2010(image: image)

        // No need to test contents of every image, mainly want to know we got the correct images.
        let imageIds = [2010, 2008, 2003]

    XCTAssertEqual(user["type"].stringValue, "user")

    let tags = image["tags"].arrayValue
    XCTAssertNotNil(tags.first, "First tag for image 2001 is nil.")
    XCTAssertEqual(tags.first?["confidence"].intValue, 75)
    XCTAssertEqual(tags.first?["label"].stringValue, "bridge")
    XCTAssertNotNil(tags[1], "Second tag for image 2001 is nil.")
    XCTAssertEqual(tags[1]["confidence"].intValue, 60)
    XCTAssertEqual(tags[1]["label"].stringValue, "city")
    XCTAssertNotNil(tags.last, "Last tag for image 2001 is nil.")
    XCTAssertEqual(tags.last?["confidence"].intValue, 50)
    XCTAssertEqual(tags.last?["label"].stringValue, "building")

    let location = image["location"]
    XCTAssertEqual(location["latitude"].stringValue, "34.53")
