Back
assert-key (clj)
(source)multimethod
(assert-key key value)
Check that the value of a key is correct immediately before the key is
initiated. If the value is incorrect, an appropriate exception should
be thrown.
Examples
integrant
(ns integrant.core-test
(:require #?(:clj [clojure.test :refer [are deftest is testing]]
:cljs [cljs.test :refer-macros [are deftest is testing]])
[integrant.core :as ig]
[weavejester.dependency :as dep]))
(defmethod ig/init-key ::n [_ v] (inc v))
(defmethod ig/assert-key ::n [_ v]
(assert (nat-int? v) "should be a natural number"))