How to block langohr RabbitMQ interaction in clojure?

I am trying to drown out RabbitMQ interactions as they are not the main purpose of the application I am writing.

So, I tried restoring langohr functions in my tests like this:

(defn stub [ch]
  (langohr.basic/ack ch 1))

(deftest test-stub
  (with-redefs [langohr.basic/ack (fn [a1 a2] true)]
    (is (= true (stub "dummy")))))

When I run the test with lein test, I get

java.lang.ClassCastException:
redwood.env_test$fn__2210$fn__2211 cannot be cast to clojure.lang.IFn$OLO

I tried several other ways, including various test environments, to override or override langohr lib functions without any success.

I tested other scripts and I successfully missed the cheshire functions (json parsing clojure lib) with the specified code structure. I humbly ask for help in understanding why my langohr stubs do not work, and advice on how I can do this elegantly.

+5
source share
1 answer

ClassCastException , langohr.basic/ack - , - , clojure.lang.IFn $OLO, OLO , long, object.

. :

(with-redefs [langohr.basic/ack (fn [a1 ^long a2] true)] ...)
+6