(:require [clojure.test :refer [deftest testing is use-fixtures]]
[example.basic-types :as basic]
[clojure.spec :as s]
[clojure.spec.gen :as gen]))
(defn once-fixture [f]
(println "Prepare for for all tests...")
(println "Clean up after all tests..."))
(defn before-any-test-fixture [f]
(println "Next test preparation...")
(println "Clean up after test..."))
(use-fixtures :once once-fixture)
(use-fixtures :each before-any-test-fixture)
(testing "testing basic types spec"
(is (= 1 1))))
(testing "testing generators for basic types"
(is (= 1000 (count (gen/sample (s/gen ::basic/string) 1000))))))
(testing "this should throw exception"
(is (thrown? ArithmeticException (/ 1 0)))))
;; This will make tests hook: only specified tests will be run.
;; Warining! if hook was installed then only specified tests will be run
;; to disable hook perform (ns-unmap *ns* 'test-ns-hook)
;(defn test-ns-hook 
;; To run particular test form some namespace use follwing command in repl:
;; if everything ok it returns nil, otherwise returns report. This will run test with existing fixtures
;; or lein test :only my.namespace/my-test