Skip to content

Commit

Permalink
Added some tests for failing union type serialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveWM committed Feb 5, 2020
1 parent 927a8db commit 5c870ca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/jackdaw/serdes/avro_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,10 @@
(is (= (->generic-record (parse-schema record-3-schema) {"a" "y" "c" "test"})
(avro/clj->avro schema-type {:a :y :c "test"} [])))
(is (= {:a :y :c "test"}
(avro/avro->clj schema-type (->generic-record (parse-schema record-3-schema) {"a" "y" "c" "test"}))))))
(avro/avro->clj schema-type (->generic-record (parse-schema record-3-schema) {"a" "y" "c" "test"}))))
(is (thrown? Exception (avro/clj->avro schema-type {:a :y} [])))
(is (thrown? Exception (avro/clj->avro schema-type {:a :x :d "test"} [])))
(is (thrown? Exception (avro/clj->avro schema-type {:a :x :b "test"} [])))))
(testing "marshalling unrecognized union type throws exception"
(let [avro-schema (parse-schema ["null" "long"])
schema-type (schema-type avro-schema)]
Expand Down

0 comments on commit 5c870ca

Please sign in to comment.