Skip to content

Commit

Permalink
minor test improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Francois committed Jan 3, 2022
1 parent 7629c0a commit d0a5de3
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions test/kinsky/client_test.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns kinsky.client-test
(:require [clojure.test :refer :all :as t]
(:require [clojure.test :refer :all :as t]
[clojure.pprint :as pp]
[kinsky.client :as client]
[kinsky.embedded :as e]))
Expand Down Expand Up @@ -32,22 +32,22 @@
(testing "string serializer"
(is (= "foo"
(String.
(.serialize (client/string-serializer) "" "foo")))))
(.serialize (client/string-serializer) "" "foo")))))

(testing "keyword serializer"
(is (= "foo"
(String.
(.serialize (client/keyword-serializer) "" :foo)))))
(.serialize (client/keyword-serializer) "" :foo)))))

(testing "edn serializer"
(is (= "{:a :b, :c :d}"
(String.
(.serialize (client/edn-serializer) "" {:a :b :c :d})))))
(.serialize (client/edn-serializer) "" {:a :b :c :d})))))

(testing "json serializer"
(is (= "[0,1,2]"
(String.
(.serialize (client/json-serializer) "" [0 1 2]))))))
(.serialize (client/json-serializer) "" [0 1 2]))))))

(deftest deserializer
(testing "string deserializer"
Expand All @@ -69,12 +69,14 @@
(.getBytes "{\"a\": \"b\", \"c\": \"d\"}"))))))

(deftest config-props
(testing "valid configuration properties"
(is (= {"foo.bar" "0"}
(client/opts->props {:foo.bar 0})))))
(testing "configuration properties"
(is (= {"foo.bar" "0" "foo.baz" "1"}
(client/opts->props {:foo.bar 0
"foo.baz" "1"
:qualified/kw :discarded})))))

(deftest rebalance-listener
(testing "idempotency"
(testing "identity when given a ConsumerRebalanceListener"
(let [sink (client/rebalance-listener (fn [& _]))]
(is (= sink (client/rebalance-listener sink)))))

Expand Down

0 comments on commit d0a5de3

Please sign in to comment.