diff --git a/mailbox-core/src/test/java/org/briarproject/mailbox/core/server/IntegrationTest.kt b/mailbox-core/src/test/java/org/briarproject/mailbox/core/server/IntegrationTest.kt
index 98c0115f563a1682a0412ff16309372565e0b580..778f9ed08e08029b9afff25ad39e886b3fce8929 100644
--- a/mailbox-core/src/test/java/org/briarproject/mailbox/core/server/IntegrationTest.kt
+++ b/mailbox-core/src/test/java/org/briarproject/mailbox/core/server/IntegrationTest.kt
@@ -113,8 +113,10 @@ abstract class IntegrationTest(private val installJsonFeature: Boolean = true) {
         }
 
         if (exceptionInBackgroundThread != null) {
-            fail("background thread has thrown an exception unexpectedly",
-                exceptionInBackgroundThread)
+            fail(
+                "background thread has thrown an exception unexpectedly",
+                exceptionInBackgroundThread
+            )
         }
     }
 
diff --git a/mailbox-core/src/test/java/org/briarproject/mailbox/core/server/ThreadExceptionTest.kt b/mailbox-core/src/test/java/org/briarproject/mailbox/core/server/ThreadExceptionTest.kt
new file mode 100644
index 0000000000000000000000000000000000000000..4a1a570c1c8c5c1d272b68ed771de6674d6b10db
--- /dev/null
+++ b/mailbox-core/src/test/java/org/briarproject/mailbox/core/server/ThreadExceptionTest.kt
@@ -0,0 +1,20 @@
+package org.briarproject.mailbox.core.server
+
+import org.junit.jupiter.api.Test
+import kotlin.concurrent.thread
+import kotlin.test.assertNotNull
+
+class ThreadExceptionTest : IntegrationTest() {
+
+    @Test
+    fun `exception thrown on background thread gets caught and stored`() {
+        val t = thread(name = "failing thread") {
+            throw RuntimeException("boom")
+        }
+        t.join()
+
+        assertNotNull(exceptionInBackgroundThread)
+        exceptionInBackgroundThread = null
+    }
+
+}