diff --git a/features/unhandled_exception.feature b/features/unhandled_exception.feature new file mode 100644 index 0000000000..0523a5efde --- /dev/null +++ b/features/unhandled_exception.feature @@ -0,0 +1,11 @@ +Feature: Android support + +Scenario: Test Unhandled Android Exception with Session + When I run "UnhandledExceptionScenario" with the defaults + Then I should receive a request + And the request is a valid for the error reporting API + And the "Bugsnag-API-Key" header equals "a35a2a72bd230ac0aa0f52715bbdc6aa" + And the payload field "notifier.name" equals "Android Bugsnag Notifier" + And the payload field "events" is an array with 1 element + And the exception "errorClass" equals "java.lang.RuntimeException" + And the exception "message" equals "UnhandledExceptionScenario" diff --git a/features/unhandled_exception_java.feature b/features/unhandled_exception_java.feature new file mode 100644 index 0000000000..c1e375a523 --- /dev/null +++ b/features/unhandled_exception_java.feature @@ -0,0 +1,11 @@ +Feature: Android support + +Scenario: Test Unhandled Android Exception with Session + When I run "UnhandledExceptionJavaScenario" with the defaults + Then I should receive a request + And the request is a valid for the error reporting API + And the "Bugsnag-API-Key" header equals "a35a2a72bd230ac0aa0f52715bbdc6aa" + And the payload field "notifier.name" equals "Android Bugsnag Notifier" + And the payload field "events" is an array with 1 element + And the exception "errorClass" equals "java.lang.RuntimeException" + And the exception "message" equals "UnhandledExceptionJavaScenario" diff --git a/mazerunner/src/main/java/com/bugsnag/android/mazerunner/scenarios/UnhandledExceptionJavaScenario.java b/mazerunner/src/main/java/com/bugsnag/android/mazerunner/scenarios/UnhandledExceptionJavaScenario.java new file mode 100644 index 0000000000..56ee032f42 --- /dev/null +++ b/mazerunner/src/main/java/com/bugsnag/android/mazerunner/scenarios/UnhandledExceptionJavaScenario.java @@ -0,0 +1,13 @@ +package com.bugsnag.android.mazerunner.scenarios; + +/** + * Sends an unhandled exception to Bugsnag. + */ +public class UnhandledExceptionJavaScenario extends Scenario { + + @Override + public void run() { + throw new RuntimeException("UnhandledExceptionJavaScenario"); + } + +} diff --git a/mazerunner/src/main/java/com/bugsnag/android/mazerunner/scenarios/UnhandledExceptionScenario.kt b/mazerunner/src/main/java/com/bugsnag/android/mazerunner/scenarios/UnhandledExceptionScenario.kt new file mode 100644 index 0000000000..233526473e --- /dev/null +++ b/mazerunner/src/main/java/com/bugsnag/android/mazerunner/scenarios/UnhandledExceptionScenario.kt @@ -0,0 +1,12 @@ +package com.bugsnag.android.mazerunner.scenarios + +/** + * Sends an unhandled exception to Bugsnag. + */ +internal class UnhandledExceptionScenario : Scenario() { + + override fun run() { + throw generateException() + } + +}