-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set test module package to com.alexstyl.contactstore.test
- Loading branch information
Showing
7 changed files
with
185 additions
and
148 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.alexstyl.contactstore"> | ||
package="com.alexstyl.contactstore.test"> | ||
|
||
</manifest> |
11 changes: 10 additions & 1 deletion
11
...om/alexstyl/contactstore/StoredContact.kt → ...exstyl/contactstore/test/StoredContact.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
207 changes: 108 additions & 99 deletions
207
...alexstyl/contactstore/TestContactStore.kt → ...tyl/contactstore/test/TestContactStore.kt
Large diffs are not rendered by default.
Oops, something went wrong.
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,18 +1,21 @@ | ||
package com.alexstyl.contactstore | ||
|
||
import com.alexstyl.contactstore.ContactColumn.GroupMemberships | ||
import com.alexstyl.contactstore.ContactColumn.Image | ||
import com.alexstyl.contactstore.ContactColumn.Mails | ||
import com.alexstyl.contactstore.ContactColumn.Names | ||
import com.alexstyl.contactstore.ContactColumn.Nickname | ||
import com.alexstyl.contactstore.ContactColumn.Note | ||
import com.alexstyl.contactstore.ContactColumn.Organization | ||
import com.alexstyl.contactstore.ContactColumn.Phones | ||
import com.alexstyl.contactstore.ContactColumn.PostalAddresses | ||
import com.alexstyl.contactstore.ContactColumn.WebAddresses | ||
package com.alexstyl.contactstore.test | ||
|
||
import com.alexstyl.contactstore.ContactColumn | ||
import com.alexstyl.contactstore.ContactFixtures | ||
import com.alexstyl.contactstore.ExperimentalContactStoreApi | ||
import com.alexstyl.contactstore.GroupMembership | ||
import com.alexstyl.contactstore.ImageData | ||
import com.alexstyl.contactstore.Label | ||
import com.alexstyl.contactstore.LabeledValue | ||
import com.alexstyl.contactstore.MailAddress | ||
import com.alexstyl.contactstore.Note | ||
import com.alexstyl.contactstore.PartialContact | ||
import com.alexstyl.contactstore.PostalAddress | ||
import com.alexstyl.contactstore.SnapshotFixtures | ||
import com.alexstyl.contactstore.WebAddress | ||
import kotlinx.coroutines.flow.first | ||
import kotlinx.coroutines.runBlocking | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.assertj.core.api.Assertions | ||
import org.junit.Test | ||
|
||
@ExperimentalContactStoreApi | ||
|
@@ -27,7 +30,7 @@ class ColumnTestContactStoreTest { | |
|
||
val actual = store.fetchContacts().first() | ||
|
||
assertThat(actual).containsOnly( | ||
Assertions.assertThat(actual).containsOnly( | ||
PartialContact( | ||
contactId = ContactFixtures.PAOLO_MELENDEZ.contactId, | ||
displayName = ContactFixtures.PAOLO_MELENDEZ.displayName, | ||
|
@@ -46,15 +49,15 @@ class ColumnTestContactStoreTest { | |
) | ||
|
||
val actual = store.fetchContacts( | ||
columnsToFetch = listOf(Names) | ||
columnsToFetch = listOf(ContactColumn.Names) | ||
).first() | ||
|
||
assertThat(actual).containsOnly( | ||
Assertions.assertThat(actual).containsOnly( | ||
PartialContact( | ||
contactId = ContactFixtures.PAOLO_MELENDEZ.contactId, | ||
displayName = ContactFixtures.PAOLO_MELENDEZ.displayName, | ||
isStarred = ContactFixtures.PAOLO_MELENDEZ.isStarred, | ||
columns = listOf(Names), | ||
columns = listOf(ContactColumn.Names), | ||
prefix = "Prefix", | ||
firstName = "Paolo", | ||
middleName = "Mid", | ||
|
@@ -73,15 +76,15 @@ class ColumnTestContactStoreTest { | |
) | ||
|
||
val actual = store.fetchContacts( | ||
columnsToFetch = listOf(Phones) | ||
columnsToFetch = listOf(ContactColumn.Phones) | ||
).first() | ||
|
||
assertThat(actual).containsOnly( | ||
Assertions.assertThat(actual).containsOnly( | ||
PartialContact( | ||
contactId = ContactFixtures.PAOLO_MELENDEZ.contactId, | ||
displayName = ContactFixtures.PAOLO_MELENDEZ.displayName, | ||
isStarred = ContactFixtures.PAOLO_MELENDEZ.isStarred, | ||
columns = listOf(Phones), | ||
columns = listOf(ContactColumn.Phones), | ||
phones = ContactFixtures.PAOLO_MELENDEZ.phones | ||
) | ||
) | ||
|
@@ -96,15 +99,15 @@ class ColumnTestContactStoreTest { | |
) | ||
|
||
val actual = store.fetchContacts( | ||
columnsToFetch = listOf(Mails) | ||
columnsToFetch = listOf(ContactColumn.Mails) | ||
).first() | ||
|
||
assertThat(actual).containsOnly( | ||
Assertions.assertThat(actual).containsOnly( | ||
PartialContact( | ||
contactId = ContactFixtures.PAOLO_MELENDEZ.contactId, | ||
displayName = ContactFixtures.PAOLO_MELENDEZ.displayName, | ||
isStarred = ContactFixtures.PAOLO_MELENDEZ.isStarred, | ||
columns = listOf(Mails), | ||
columns = listOf(ContactColumn.Mails), | ||
mails = listOf( | ||
LabeledValue(MailAddress("[email protected]"), Label.LocationHome) | ||
) | ||
|
@@ -121,15 +124,15 @@ class ColumnTestContactStoreTest { | |
) | ||
|
||
val actual = store.fetchContacts( | ||
columnsToFetch = listOf(Organization) | ||
columnsToFetch = listOf(ContactColumn.Organization) | ||
).first() | ||
|
||
assertThat(actual).containsOnly( | ||
Assertions.assertThat(actual).containsOnly( | ||
PartialContact( | ||
contactId = ContactFixtures.PAOLO_MELENDEZ.contactId, | ||
displayName = ContactFixtures.PAOLO_MELENDEZ.displayName, | ||
isStarred = ContactFixtures.PAOLO_MELENDEZ.isStarred, | ||
columns = listOf(Organization), | ||
columns = listOf(ContactColumn.Organization), | ||
organization = "Organization", | ||
jobTitle = "Job Title" | ||
) | ||
|
@@ -145,15 +148,15 @@ class ColumnTestContactStoreTest { | |
) | ||
|
||
val actual = store.fetchContacts( | ||
columnsToFetch = listOf(Image) | ||
columnsToFetch = listOf(ContactColumn.Image) | ||
).first() | ||
|
||
assertThat(actual).containsOnly( | ||
Assertions.assertThat(actual).containsOnly( | ||
PartialContact( | ||
contactId = ContactFixtures.PAOLO_MELENDEZ.contactId, | ||
displayName = ContactFixtures.PAOLO_MELENDEZ.displayName, | ||
isStarred = ContactFixtures.PAOLO_MELENDEZ.isStarred, | ||
columns = listOf(Image), | ||
columns = listOf(ContactColumn.Image), | ||
imageData = ImageData("imagedata".toByteArray()) | ||
) | ||
) | ||
|
@@ -168,15 +171,15 @@ class ColumnTestContactStoreTest { | |
) | ||
|
||
val actual = store.fetchContacts( | ||
columnsToFetch = listOf(Note) | ||
columnsToFetch = listOf(ContactColumn.Note) | ||
).first() | ||
|
||
assertThat(actual).containsOnly( | ||
Assertions.assertThat(actual).containsOnly( | ||
PartialContact( | ||
contactId = ContactFixtures.PAOLO_MELENDEZ.contactId, | ||
displayName = ContactFixtures.PAOLO_MELENDEZ.displayName, | ||
isStarred = ContactFixtures.PAOLO_MELENDEZ.isStarred, | ||
columns = listOf(Note), | ||
columns = listOf(ContactColumn.Note), | ||
note = Note("note") | ||
) | ||
) | ||
|
@@ -191,15 +194,15 @@ class ColumnTestContactStoreTest { | |
) | ||
|
||
val actual = store.fetchContacts( | ||
columnsToFetch = listOf(PostalAddresses) | ||
columnsToFetch = listOf(ContactColumn.PostalAddresses) | ||
).first() | ||
|
||
assertThat(actual).containsOnly( | ||
Assertions.assertThat(actual).containsOnly( | ||
PartialContact( | ||
contactId = ContactFixtures.PAOLO_MELENDEZ.contactId, | ||
displayName = ContactFixtures.PAOLO_MELENDEZ.displayName, | ||
isStarred = ContactFixtures.PAOLO_MELENDEZ.isStarred, | ||
columns = listOf(PostalAddresses), | ||
columns = listOf(ContactColumn.PostalAddresses), | ||
postalAddresses = listOf( | ||
LabeledValue(PostalAddress("SomeStreet 55"), Label.LocationHome) | ||
) | ||
|
@@ -216,15 +219,15 @@ class ColumnTestContactStoreTest { | |
) | ||
|
||
val actual = store.fetchContacts( | ||
columnsToFetch = listOf(Nickname) | ||
columnsToFetch = listOf(ContactColumn.Nickname) | ||
).first() | ||
|
||
assertThat(actual).containsOnly( | ||
Assertions.assertThat(actual).containsOnly( | ||
PartialContact( | ||
contactId = ContactFixtures.PAOLO_MELENDEZ.contactId, | ||
displayName = ContactFixtures.PAOLO_MELENDEZ.displayName, | ||
isStarred = ContactFixtures.PAOLO_MELENDEZ.isStarred, | ||
columns = listOf(Nickname), | ||
columns = listOf(ContactColumn.Nickname), | ||
nickname = "Nickname" | ||
) | ||
) | ||
|
@@ -239,15 +242,15 @@ class ColumnTestContactStoreTest { | |
) | ||
|
||
val actual = store.fetchContacts( | ||
columnsToFetch = listOf(WebAddresses) | ||
columnsToFetch = listOf(ContactColumn.WebAddresses) | ||
).first() | ||
|
||
assertThat(actual).containsOnly( | ||
Assertions.assertThat(actual).containsOnly( | ||
PartialContact( | ||
contactId = ContactFixtures.PAOLO_MELENDEZ.contactId, | ||
displayName = ContactFixtures.PAOLO_MELENDEZ.displayName, | ||
isStarred = ContactFixtures.PAOLO_MELENDEZ.isStarred, | ||
columns = listOf(WebAddresses), | ||
columns = listOf(ContactColumn.WebAddresses), | ||
webAddresses = listOf( | ||
LabeledValue(WebAddress("www.web.com"), Label.WebsiteHomePage) | ||
) | ||
|
@@ -264,19 +267,19 @@ class ColumnTestContactStoreTest { | |
) | ||
|
||
val actual = store.fetchContacts( | ||
columnsToFetch = listOf(GroupMemberships) | ||
columnsToFetch = listOf(ContactColumn.GroupMemberships) | ||
).first() | ||
|
||
assertThat(actual).containsOnly( | ||
Assertions.assertThat(actual).containsOnly( | ||
PartialContact( | ||
contactId = ContactFixtures.PAOLO_MELENDEZ.contactId, | ||
displayName = ContactFixtures.PAOLO_MELENDEZ.displayName, | ||
isStarred = ContactFixtures.PAOLO_MELENDEZ.isStarred, | ||
columns = listOf(GroupMemberships), | ||
columns = listOf(ContactColumn.GroupMemberships), | ||
groups = listOf( | ||
GroupMembership(groupId = 10) | ||
) | ||
) | ||
) | ||
} | ||
} | ||
} |
10 changes: 9 additions & 1 deletion
10
...ntactstore/ExecuteTestContactStoreTest.kt → ...store/test/ExecuteTestContactStoreTest.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
2 changes: 2 additions & 0 deletions
2
...ava/com/alexstyl/contactstore/Fixtures.kt → ...om/alexstyl/contactstore/test/Fixtures.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
8 changes: 7 additions & 1 deletion
8
...actstore/PredicateTestContactStoreTest.kt → ...ore/test/PredicateTestContactStoreTest.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