Skip to content
Browse files

refactor some of the tests to use (thrown-with-msg? ...)

  • Loading branch information...
1 parent 033c405 commit bc4211e21e164dac1dac8784b267abd19d8ac111 @pingles committed Sep 4, 2013
Showing with 4 additions and 7 deletions.
  1. +1 −1 src/clj_hector/serialize.clj
  2. +3 −6 test/clj_hector/test/serialize.clj
View
2 src/clj_hector/serialize.clj
@@ -55,7 +55,7 @@
(cond (keyword? x) (x serializers)
(instance? Serializer x) x
:else (SerializerTypeInferer/getSerializer x))
- (throw (NullPointerException. (str x " did not resolve to a serializer.")))))
+ (throw (IllegalArgumentException. (str x " did not resolve to a serializer.")))))
(defn- deserialize-composite
"Given a composite and a list of deserializers deserialize the
View
9 test/clj_hector/test/serialize.clj
@@ -20,9 +20,6 @@
(is (= :kw (.fromBytes s (.toBytes s :kw))))))
(deftest bad-serializer-name
- (is (thrown? NullPointerException (serializer :bad-serializer-keyword)))
- (try
- (serializer :bad-serializer-keyword)
- (is false "Should have gotten a NPE")
- (catch NullPointerException e
- (is (= ":bad-serializer-keyword did not resolve to a serializer." (.getMessage e))))))
+ (is (thrown-with-msg? IllegalArgumentException
+ #"bad-serializer-keyword did not resolve to a serializer"
+ (serializer :bad-serializer-keyword))))

0 comments on commit bc4211e

Please sign in to comment.
Something went wrong with that request. Please try again.