-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
109 additions
and
92 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/kotlin/at/bitfire/davdroid/resource/LocalAddressBookStoreTest.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,26 @@ | ||
package at.bitfire.davdroid.resource | ||
|
||
import at.bitfire.davdroid.db.Collection | ||
import io.mockk.every | ||
import io.mockk.mockk | ||
import org.junit.Assert.assertFalse | ||
import org.junit.Assert.assertTrue | ||
import org.junit.Test | ||
|
||
class LocalAddressBookStoreTest { | ||
|
||
/** | ||
* Tests the calculation of read only state is correct | ||
*/ | ||
@Test | ||
fun test_shouldBeReadOnly() { | ||
val collectionReadOnly = mockk<Collection> { every { readOnly() } returns true } | ||
assertTrue(LocalAddressBookStore.shouldBeReadOnly(collectionReadOnly, false)) | ||
assertTrue(LocalAddressBookStore.shouldBeReadOnly(collectionReadOnly, true)) | ||
|
||
val collectionNotReadOnly = mockk<Collection> { every { readOnly() } returns false } | ||
assertFalse(LocalAddressBookStore.shouldBeReadOnly(collectionNotReadOnly, false)) | ||
assertTrue(LocalAddressBookStore.shouldBeReadOnly(collectionNotReadOnly, true)) | ||
} | ||
|
||
} |
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
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