   (checking
    "Functions that throw exceptions pass the exception object back"
    (times 30)
-   [input (gen/vector (gen/hash-map :message (gen/map gen/any gen/any)))]
+   [input (gen/vector (gen-segment))]
    (let [f (fn [segment] (throw (ex-info "exception" {:val 42})))
          event {:onyx.core/batch input}
          rets (t/apply-fn f false event)

  (checking
   "Multiple segments can be returned, attached to their root"
   (times 30)
   [input (gen/hash-map :message (gen/map gen/any gen/any))
    output (gen/vector (gen/map gen/any gen/any))]
   (let [f (fn [segment] output)
         event {:onyx.core/batch [input]}

            [onyx.peer.task-lifecycle :as t]
            [onyx.api]))

(defn gen-segment []
  (gen/hash-map :message (gen/map gen/any gen/any)))

(deftest singe-segment-return
  (checking
   "A single returned segment attaches to its root"
   (times 30)
   [input (gen-segment)
    output (gen/map gen/any gen/any)]
   (let [f (fn [segment] output)
         event {:onyx.core/batch [input]}
