             (is (= 1 (:exit-code res)))
             (is (= 1 (-> build-doc :process :exit-code)))
             (is (= 2 (count (store/get-failures opts (:id build-doc)))))
-            (is (.contains (-> @email :body first :content)
-                           "com.example.AppTest <b>testBad</b>")
-                (with-out-str
-                  (clojure.pprint/pprint @email)))))))))
+            (let [body (:body @email)
+                  content (find-content body)]
+              (when (is content body)
+                (is (.contains content
+                               "com.example.AppTest <b>testBad</b>")
+                    (with-out-str
+                      (clojure.pprint/pprint @email)))))))))))
 
 (deftest log
   (testing "log present"

  (is (= "foo@q***.dom"
         (email/obfuscate-addr "foo@bar.quux.dom"))))

(deftest attached
  (testing "failures present"
    (let [email (atom [])]

                         "test/fail-gradle-no-task.bat"
                         "test/fail-gradle-no-task.bash"))))]
              (is (= 1 (-> build-doc :process :exit-code)))
              (let [body (:body @email)
                    content (find-content body)]
                (when (is content body)
                  (is (.contains content "Cannot expand ZIP")))
                (is (= 3 (count body))
                    (pr-str @email)))))
          (testing "with gradle task"
            (let [out (java.io.StringWriter.)
                  [opts res build-doc]
