forked from mozilla-mobile/fenix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close mozilla-mobile#20267: Filter out network errors from Nimbus
- Loading branch information
1 parent
bbea03e
commit 2c40bb4
Showing
2 changed files
with
47 additions
and
1 deletion.
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
28 changes: 28 additions & 0 deletions
28
app/src/test/java/org/mozilla/fenix/experiments/NimbusSetupKtTest.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,28 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package org.mozilla.fenix.experiments | ||
|
||
import org.junit.Assert.assertFalse | ||
import org.junit.Assert.assertTrue | ||
import org.junit.Test | ||
import org.mozilla.experiments.nimbus.internal.NimbusErrorException | ||
|
||
class NimbusSetupKtTest { | ||
@Test | ||
fun `WHEN error is reportable THEN return true`() { | ||
val error = NimbusErrorException.IOError("bad error") | ||
|
||
assertTrue(error.isReportableError()) | ||
} | ||
|
||
@Test | ||
fun `WHEN error is non-reportable THEN return false`() { | ||
val error1 = NimbusErrorException.ResponseError("oops") | ||
val error2 = NimbusErrorException.RequestError("oops") | ||
|
||
assertFalse(error1.isReportableError()) | ||
assertFalse(error2.isReportableError()) | ||
} | ||
} |