Skip to content

Instantly share code, notes, and snippets.

@technomancy
Created January 18, 2018 20:11
Show Gist options
  • Save technomancy/3de56f5ff315f12cf0170567261b2a9a to your computer and use it in GitHub Desktop.
Save technomancy/3de56f5ff315f12cf0170567261b2a9a to your computer and use it in GitHub Desktop.
;; works
(let [factory clojure.tools.logging/*logger-factory*]
(try
(alter-var-root #'clojure.tools.logging/*logger-factory*
(constantly clojure.tools.logging.impl/disabled-logger-factory))
(is (thrown-with-msg? Exception #"Message not processed"
(test-utils/process-message! msg 2)))
(finally
(alter-var-root #'clojure.tools.logging/*logger-factory* factory))))
;; doesn't work
(with-redefs [clojure.tools.logging/*logger-factory*
clojure.tools.logging.impl/disabled-logger-factory]
(is (thrown-with-msg? Exception #"Message not processed"
(test-utils/process-message! msg 2))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment