Permalink
Browse files

Use exception-cause? instead of thrown?

  • Loading branch information...
1 parent cd81d91 commit 873f52dc6814c3cb27e3a28092a4d400bfde879c Derek Dagit committed Feb 16, 2013
Showing with 9 additions and 16 deletions.
  1. +9 −16 test/clj/backtype/storm/security/serialization/BlowfishTupleSerializer_test.clj
View
25 test/clj/backtype/storm/security/serialization/BlowfishTupleSerializer_test.clj
@@ -1,29 +1,22 @@
(ns backtype.storm.security.serialization.BlowfishTupleSerializer-test
- (:use [
- clojure test])
+ (:use [clojure test]
+ [backtype.storm.util :only (exception-cause?)]
+ )
(:import [backtype.storm.security.serialization BlowfishTupleSerializer]
[backtype.storm.utils ListDelegate]
[com.esotericsoftware.kryo Kryo]
[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
(let [conf {}]
- (is (thrown? java.lang.RuntimeException
- (unpack-runtime-exception
- '(new BlowfishTupleSerializer nil conf)))
- "Throws RuntimeException when no encryption key is given."
+ (try
+ (new BlowfishTupleSerializer nil conf)
+ (catch Throwable t
+ (is (exception-cause? java.lang.RuntimeException t)
+ "Throws RuntimeException when no encryption key is given.")
+ )
)
)
)

0 comments on commit 873f52d

Please sign in to comment.