Skip to content

Commit

Permalink
Use exception-cause? instead of thrown?
Browse files Browse the repository at this point in the history
  • Loading branch information
Derek Dagit committed Feb 16, 2013
1 parent cd81d91 commit 873f52d
Showing 1 changed file with 9 additions and 16 deletions.
@@ -1,29 +1,22 @@
(ns backtype.storm.security.serialization.BlowfishTupleSerializer-test (ns backtype.storm.security.serialization.BlowfishTupleSerializer-test
(:use [ (:use [clojure test]
clojure test]) [backtype.storm.util :only (exception-cause?)]
)
(:import [backtype.storm.security.serialization BlowfishTupleSerializer] (:import [backtype.storm.security.serialization BlowfishTupleSerializer]
[backtype.storm.utils ListDelegate] [backtype.storm.utils ListDelegate]
[com.esotericsoftware.kryo Kryo] [com.esotericsoftware.kryo Kryo]
[com.esotericsoftware.kryo.io Input Output] [com.esotericsoftware.kryo.io Input Output]
) )
) )


; Exceptions are getting wrapped in RuntimeException. This might be due to
; CLJ-855.
(defn- unpack-runtime-exception [expression]
(try (eval expression)
nil
(catch java.lang.RuntimeException gripe
(throw (.getCause gripe)))
)
)

(deftest test-constructor-throws-on-null-key (deftest test-constructor-throws-on-null-key
(let [conf {}] (let [conf {}]
(is (thrown? java.lang.RuntimeException (try
(unpack-runtime-exception (new BlowfishTupleSerializer nil conf)
'(new BlowfishTupleSerializer nil conf))) (catch Throwable t
"Throws RuntimeException when no encryption key is given." (is (exception-cause? java.lang.RuntimeException t)
"Throws RuntimeException when no encryption key is given.")
)
) )
) )
) )
Expand Down

0 comments on commit 873f52d

Please sign in to comment.