shrubbery icon indicating copy to clipboard operation
shrubbery copied to clipboard

IllegalArgumentException at the simple example

Open itaied246 opened this issue 7 years ago • 1 comments

I'm trying to use this library, but I get the following error:

java.lang.IllegalArgumentException: db-spec xchange.data.user_test$eval27076$reify__27077@6ea22666 is missing a required parameter
 at clojure.java.jdbc$get_connection.invokeStatic (jdbc.clj:379)
    clojure.java.jdbc$get_connection.invoke (jdbc.clj:226)
    clojure.java.jdbc$insert_rows_BANG_.invokeStatic (jdbc.clj:1301)
... 
  (:require [my.utils.db :refer [insert]])

(defn create-user
  [conn user]
  (insert conn :users user))

(defprotocol DbQueryClient
  (insert [conn table user]))

(def db-stub
  (stub DbQueryClient
        {:insert :ok}))

(deftest user
  (testing "stub"
    (is (= :ok (create-user db-stub {:name "itaied"})))))

Am I missing something?

itaied246 avatar Jan 11 '18 17:01 itaied246

The example you gave looks right to me. Is there any chance you can reproduce the error in isolation, so I have a working example I can debug? Clearly it's still attempting to make a database connection somewhere.

bguthrie avatar Jan 19 '18 23:01 bguthrie