-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replaces tests for context logic on error with existing e2e tests
- Loading branch information
Showing
9 changed files
with
94 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...erunner/src/main/java/com/bugsnag/android/mazerunner/scenarios/ArgumentContextScenario.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.bugsnag.android.mazerunner.scenarios | ||
|
||
import android.content.Context | ||
import com.bugsnag.android.Bugsnag | ||
import com.bugsnag.android.Configuration | ||
import com.bugsnag.android.MetaData | ||
import com.bugsnag.android.Severity | ||
import com.bugsnag.android.mazerunner.scenarios.Scenario | ||
|
||
/** | ||
* Sends a handled exception to Bugsnag, which includes manual context. | ||
*/ | ||
internal class ArgumentContextScenario(config: Configuration, | ||
context: Context) : Scenario(config, context) { | ||
init { | ||
config.setAutoCaptureSessions(false) | ||
} | ||
|
||
override fun run() { | ||
super.run() | ||
Bugsnag.getClient().notify("RuntimeException", "deprecated", "NewContext", emptyArray<StackTraceElement>(), Severity.ERROR, MetaData()) | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
...n/java/com/bugsnag/android/mazerunner/scenarios/NotifyBeforeSendUnsetContextScenario.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.bugsnag.android.mazerunner.scenarios; | ||
|
||
import com.bugsnag.android.Bugsnag; | ||
import com.bugsnag.android.BeforeSend; | ||
import com.bugsnag.android.Configuration; | ||
import com.bugsnag.android.Report; | ||
import com.bugsnag.android.Severity; | ||
|
||
import android.content.Context; | ||
import android.support.annotation.NonNull; | ||
|
||
|
||
public class NotifyBeforeSendUnsetContextScenario extends Scenario { | ||
|
||
public NotifyBeforeSendUnsetContextScenario(@NonNull Configuration config, @NonNull Context context) { | ||
super(config, context); | ||
config.setAutoCaptureSessions(false); | ||
config.beforeSend(new BeforeSend() { | ||
@Override | ||
public boolean run(Report report) { | ||
report.getError().setContext(null); | ||
report.getError().setSeverity(Severity.ERROR); | ||
|
||
return true; | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public void run() { | ||
super.run(); | ||
Bugsnag.notify(new Exception("Registration failure")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters