-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SettingsImporter::getImportStreamContents throw exception when both g…
…lobal and account setting is absent
- Loading branch information
1 parent
fb561e3
commit 482ca1a
Showing
2 changed files
with
35 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
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 |
---|---|---|
|
@@ -269,6 +269,9 @@ class SettingsImporterTest : K9RobolectricTest() { | |
<email>[email protected]</email> | ||
</identity> | ||
</identities> | ||
<settings> | ||
<value key="a">b</value> | ||
</settings> | ||
</account> | ||
</accounts> | ||
</k9settings> | ||
|
@@ -302,6 +305,9 @@ class SettingsImporterTest : K9RobolectricTest() { | |
<email>[email protected]</email> | ||
</identity> | ||
</identities> | ||
<settings> | ||
<value key="a">b</value> | ||
</settings> | ||
</account> | ||
</accounts> | ||
</k9settings> | ||
|
@@ -320,4 +326,29 @@ class SettingsImporterTest : K9RobolectricTest() { | |
} | ||
} | ||
} | ||
|
||
@Test | ||
fun `getImportStreamContents() should throw when no setting is present in inputStream`() { | ||
val accountUuid = UUID.randomUUID().toString() | ||
val inputStream = | ||
""" | ||
<k9settings format="1" version="1"> | ||
<accounts> | ||
<account uuid="$accountUuid"> | ||
<name></name> | ||
<identities> | ||
<identity> | ||
<email>[email protected]</email> | ||
</identity> | ||
</identities> | ||
</account> | ||
</accounts> | ||
</k9settings> | ||
""".trimIndent().byteInputStream() | ||
|
||
assertFailure { | ||
settingsImporter.getImportStreamContents(inputStream) | ||
}.isInstanceOf<SettingsImportExportException>() | ||
|
||
} | ||
} |