Fork me on GitHub
juan caicedo18:07:33

Hi everyone! I'm working on some test that use a java object. I'm thinking it would be nice to mock that out. I've gathered that reify might be the best way to do this. This is how I'm trying to wire up my test

(let [mock (reify LDClientInterface (allFlags [client ld-user] "flags"))]
      (with-redefs-fn {#'my-ns/init-client (fn [] mock)} ;; line 10
        #(is= (my-ns/foo) false))
However I'm getting this error, which makes me think I'm wiring something wrong
java.lang.ClassCastException: circle.util.test_launchdarkly$fn$reify__106395 cannot be cast to clojure.lang.IFn
  <<stack trace points to line 10>>