         XCTAssertEqual(true, checker.nameSpanCalled)
 
         XCTAssertEqual(1, URLSessionLogger.runningSpans.count)
-        let span = URLSessionLogger.runningSpans["id"]!
-        XCTAssertEqual("HTTP GET", span.name)
+        XCTAssertNotNil(URLSessionLogger.runningSpans["id"])
+        if let span = URLSessionLogger.runningSpans["id"] {
+            XCTAssertEqual("HTTP GET", span.name)
+        }
     }
 }

        XCTAssertEqual(true, checker.nameSpanCalled)

        XCTAssertEqual(1, URLSessionLogger.runningSpans.count)
        let span = URLSessionLogger.runningSpans["id"]!
        XCTAssertEqual("new name", span.name)
    }

    public func testDefaultSpanName() {

        URLSessionLogger.processAndLogRequest(request, sessionTaskId: "id", instrumentation: instrumentation, shouldInjectHeaders: true)

        XCTAssertEqual(1, URLSessionLogger.runningSpans.count)
        XCTAssertNotNil(URLSessionLogger.runningSpans["id"])
        if let span = URLSessionLogger.runningSpans["id"] {
            XCTAssertEqual("HTTP GET", span.name)
        }
    }

    public func testDefaultSpanWithNameClosure() {
