diff --git a/features/fixtures/mazerunner/jvm-scenarios/detekt-baseline.xml b/features/fixtures/mazerunner/jvm-scenarios/detekt-baseline.xml
index 660c0114eb..5339ffeeda 100644
--- a/features/fixtures/mazerunner/jvm-scenarios/detekt-baseline.xml
+++ b/features/fixtures/mazerunner/jvm-scenarios/detekt-baseline.xml
@@ -23,6 +23,7 @@
TooGenericExceptionThrown:CrashHandlerScenario.kt$CrashHandlerScenario$throw RuntimeException("CrashHandlerScenario")
TooGenericExceptionThrown:CustomHttpClientFlushScenario.kt$CustomHttpClientFlushScenario$throw RuntimeException("ReportCacheScenario")
TooGenericExceptionThrown:DisableAutoDetectErrorsScenario.kt$DisableAutoDetectErrorsScenario$throw RuntimeException("Should never appear")
+ TooGenericExceptionThrown:OnSendCallbackScenario.kt$OnSendCallbackScenario$throw RuntimeException("Unhandled Error")
TooGenericExceptionThrown:ReportCacheScenario.kt$ReportCacheScenario$throw RuntimeException("ReportCacheScenario")
TooGenericExceptionThrown:StartupCrashFlushScenario.kt$StartupCrashFlushScenario$throw RuntimeException("Regular crash")
TooGenericExceptionThrown:StartupCrashFlushScenario.kt$StartupCrashFlushScenario$throw RuntimeException("Startup crash")
diff --git a/features/fixtures/mazerunner/jvm-scenarios/src/main/java/com/bugsnag/android/TestOnSendCallback.java b/features/fixtures/mazerunner/jvm-scenarios/src/main/java/com/bugsnag/android/TestOnSendCallback.java
new file mode 100644
index 0000000000..d582b007cd
--- /dev/null
+++ b/features/fixtures/mazerunner/jvm-scenarios/src/main/java/com/bugsnag/android/TestOnSendCallback.java
@@ -0,0 +1,15 @@
+package com.bugsnag.android;
+
+import java.util.Collections;
+
+public class TestOnSendCallback implements OnSendCallback {
+ @Override
+ public boolean onSend(Event event) {
+ event.addMetadata("mazerunner", Collections.singletonMap("onSendCallback", "true"));
+ return true;
+ }
+
+ public void register(Configuration config) {
+ config.addOnSend(this);
+ }
+}
\ No newline at end of file
diff --git a/features/fixtures/mazerunner/jvm-scenarios/src/main/java/com/bugsnag/android/mazerunner/scenarios/OnSendCallbackScenario.kt b/features/fixtures/mazerunner/jvm-scenarios/src/main/java/com/bugsnag/android/mazerunner/scenarios/OnSendCallbackScenario.kt
new file mode 100644
index 0000000000..45bf83f64b
--- /dev/null
+++ b/features/fixtures/mazerunner/jvm-scenarios/src/main/java/com/bugsnag/android/mazerunner/scenarios/OnSendCallbackScenario.kt
@@ -0,0 +1,25 @@
+package com.bugsnag.android.mazerunner.scenarios
+
+import android.content.Context
+import com.bugsnag.android.Configuration
+import com.bugsnag.android.TestOnSendCallback
+import java.lang.RuntimeException
+
+internal class OnSendCallbackScenario(
+ config: Configuration,
+ context: Context,
+ eventMetadata: String
+) : Scenario(config, context, eventMetadata) {
+ override fun startBugsnag(startBugsnagOnly: Boolean) {
+ TestOnSendCallback().register(config)
+ super.startBugsnag(startBugsnagOnly)
+ }
+
+ override fun startScenario() {
+ super.startScenario()
+
+ if (eventMetadata != "start-only") {
+ throw RuntimeException("Unhandled Error")
+ }
+ }
+}
diff --git a/features/full_tests/onsend_callback.feature b/features/full_tests/onsend_callback.feature
new file mode 100644
index 0000000000..ef7bc6ef03
--- /dev/null
+++ b/features/full_tests/onsend_callback.feature
@@ -0,0 +1,10 @@
+Feature: OnSend Callbacks can alter Events before upload
+
+ Scenario: Handled exception with altered by OnSendCallback
+ When I run "OnSendCallbackScenario" and relaunch the app
+ And I configure the app to run in the "start-only" state
+ And I configure Bugsnag for "OnSendCallbackScenario"
+ Then I wait to receive an error
+ And the error payload field "events" is an array with 1 elements
+ And the exception "message" equals "Unhandled Error"
+ And the event "metaData.mazerunner.onSendCallback" equals "true"
\ No newline at end of file