-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: update internal error report test to trigger error from corrupt…
…ed json file
- Loading branch information
1 parent
876e5b0
commit 1cce3bc
Showing
5 changed files
with
61 additions
and
7 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
.../mazerunner/src/main/java/com/bugsnag/android/mazerunner/scenarios/EmptyReportScenario.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,19 @@ | ||
package com.bugsnag.android.mazerunner.scenarios | ||
|
||
import android.content.Context | ||
import com.bugsnag.android.Bugsnag | ||
import com.bugsnag.android.Configuration | ||
import java.io.File | ||
|
||
/** | ||
* Verifies that if a report is empty, minimal information is still sent to bugsnag. | ||
*/ | ||
internal class EmptyReportScenario(config: Configuration, | ||
context: Context) : Scenario(config, context) { | ||
|
||
init { | ||
config.setAutoCaptureSessions(false) | ||
val files = File(context.cacheDir, "bugsnag-errors").listFiles() | ||
files.forEach { it.writeText("") } | ||
} | ||
} |
13 changes: 10 additions & 3 deletions
13
...zerunner/src/main/java/com/bugsnag/android/mazerunner/scenarios/InternalReportScenario.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 |
---|---|---|
@@ -1,17 +1,24 @@ | ||
package com.bugsnag.android.mazerunner.scenarios | ||
|
||
import android.content.Context | ||
import com.bugsnag.android.* | ||
import com.bugsnag.android.Bugsnag | ||
import com.bugsnag.android.Configuration | ||
import java.io.File | ||
|
||
/** | ||
* Sends a handled exception to Bugsnag, which does not include session data. | ||
*/ | ||
internal class InternalReportScenario(config: Configuration, | ||
context: Context) : Scenario(config, context) { | ||
|
||
init { | ||
config.setAutoCaptureSessions(false) | ||
disableAllDelivery(config) | ||
} | ||
|
||
override fun run() { | ||
super.run() | ||
sendInternalReport(RuntimeException("Whoops"), config, Bugsnag.getClient()) | ||
Bugsnag.notify(java.lang.RuntimeException("Whoops")) | ||
} | ||
|
||
} | ||
} |
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
19 changes: 19 additions & 0 deletions
19
.../mazerunner/src/main/java/com/bugsnag/android/mazerunner/scenarios/EmptyReportScenario.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,19 @@ | ||
package com.bugsnag.android.mazerunner.scenarios | ||
|
||
import android.content.Context | ||
import com.bugsnag.android.Bugsnag | ||
import com.bugsnag.android.Configuration | ||
import java.io.File | ||
|
||
/** | ||
* Verifies that if a report is empty, minimal information is still sent to bugsnag. | ||
*/ | ||
internal class EmptyReportScenario(config: Configuration, | ||
context: Context) : Scenario(config, context) { | ||
|
||
init { | ||
config.setAutoCaptureSessions(false) | ||
val files = File(context.cacheDir, "bugsnag-errors").listFiles() | ||
files.forEach { it.writeText("") } | ||
} | ||
} |
13 changes: 10 additions & 3 deletions
13
...zerunner/src/main/java/com/bugsnag/android/mazerunner/scenarios/InternalReportScenario.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 |
---|---|---|
@@ -1,17 +1,24 @@ | ||
package com.bugsnag.android.mazerunner.scenarios | ||
|
||
import android.content.Context | ||
import com.bugsnag.android.* | ||
import com.bugsnag.android.Bugsnag | ||
import com.bugsnag.android.Configuration | ||
import java.io.File | ||
|
||
/** | ||
* Sends a handled exception to Bugsnag, which does not include session data. | ||
*/ | ||
internal class InternalReportScenario(config: Configuration, | ||
context: Context) : Scenario(config, context) { | ||
|
||
init { | ||
config.setAutoCaptureSessions(false) | ||
disableAllDelivery(config) | ||
} | ||
|
||
override fun run() { | ||
super.run() | ||
sendInternalReport(RuntimeException("Whoops"), config, Bugsnag.getClient()) | ||
Bugsnag.notify(java.lang.RuntimeException("Whoops")) | ||
} | ||
|
||
} | ||
} |