   (testing "Creating sessions with a variety of parameters"
     (testing "...with just URI"
       (is (thrown? IllegalStateException
-                   (let [session (create-session {:uri "xdbc://localhost:8383/"})]
+                   (with-open [session (create-session {:uri "xdbc://localhost:8383/"})]
                      (.submitRequest session (.newAdhocQuery session "\"Hello world\""))))))
 
     (testing "...with URI and content-base"
       (is (thrown? IllegalStateException
-                   (let [session (create-session {:uri "xdbc://localhost:8383/"
-                                                  :content-base "TutorialDB"})]
+                   (with-open [session (create-session {:uri "xdbc://localhost:8383/"
+                                                        :content-base "TutorialDB"})]
                      (.submitRequest session (.newAdhocQuery session "\"Hello world\""))))))
 
     (testing "...with URI, user, password"
       (is (= "Hello world"
-             (let [session (create-session {:uri "xdbc://localhost:8383/"
-                                            :user "rest-admin" :password "x"})]
+             (with-open [session (create-session {:uri "xdbc://localhost:8383/"
+                                                  :user "rest-admin" :password "x"})]
                (-> session
                    (.submitRequest (.newAdhocQuery session
                                                    "\"Hello world\""))

;; TODO test `as-is?`
;; TODO test (all?) variable types
;; TODO test default xs_string map structure


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; TODO Type conversion
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(deftest default-session-config
  (testing "A session with no explicitly-set configuration must have default configuration"
    (testing "basic session creation with full database specified"
      (with-open [sess (create-session db)]
        (is-default-session-config? (session->map sess))))
    (testing "session creation with URI content source"
      (with-open [sess (create-session
                        db (make-uri-content-source "xdbc://localhost:8383/") {})]
        (is-default-session-config? (session->map sess))))
    (testing "session creation with URI content source using options"
      (with-open [sess (create-session
                        db (make-uri-content-source
                            "xdbc://localhost:8383/"
                            {:preemptive-auth false
                             :default-logger (Logger/getLogger "foobar")}))]
        (is-default-session-config? (session->map sess))))
    (testing "session creation with hosted content source"
      (with-open [sess (create-session
                        db (make-hosted-content-source "localhost" 8383) {})]
        (is-default-session-config? (session->map sess))))
    (testing "session creation with hosted content source using options"
      (with-open [sess (create-session
                        db (make-hosted-content-source "localhost" 8383
                                                       {:content-base "TutorialDB"})
                        {})]
        (is-default-session-config? (session->map sess))))
    ;; TODO once we want to delve into extreme complexity of ConnectionProvider
    ;; (testing "session creation with connectionProvider content source"
    ;;   (with-open [sess (create-session
    ;;                     db (make-cp-content-source ...)
    ;;                     {})]
    ;;     (is-default-session-config? (session->map sess))))
    ;; TODO once we want to delve into extreme complexity of ConnectionProvider
    ;; (testing "session creation with connectionProvider content source with options"
    ;;   (with-open [sess (create-session
    ;;                     db (make-cp-content-source ...) {})])
    ;;   (is-default-session-config? (session->map sess)))
    ))

;; (deftest accept-only-valid-session-options
