-
-
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.
Remove strong types from ContactPredicates
- Loading branch information
Showing
5 changed files
with
88 additions
and
42 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
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
package com.alexstyl.contactstore | ||
|
||
import com.alexstyl.contactstore.ContactPredicate.MailLookup | ||
import com.alexstyl.contactstore.ContactPredicate.NameLookup | ||
import com.alexstyl.contactstore.ContactPredicate.PhoneLookup | ||
import kotlinx.coroutines.ExperimentalCoroutinesApi | ||
import kotlinx.coroutines.flow.first | ||
import kotlinx.coroutines.runBlocking | ||
|
@@ -31,9 +33,7 @@ internal class ContactStoreLookupTest : ContactStoreTestBase() { | |
|
||
@Test | ||
fun lookupByPhoneNumber(): Unit = runBlocking { | ||
val actual = store.fetchContacts( | ||
ContactPredicate.PhoneLookup(PhoneNumber("555")) | ||
).first() | ||
val actual = store.fetchContacts(PhoneLookup("555")).first() | ||
val expected = listOf( | ||
paoloMelendez() | ||
) | ||
|
@@ -42,9 +42,7 @@ internal class ContactStoreLookupTest : ContactStoreTestBase() { | |
|
||
@Test | ||
fun lookupByMail(): Unit = runBlocking { | ||
val actual = store.fetchContacts( | ||
ContactPredicate.MailLookup(MailAddress("[email protected]")) | ||
).first() | ||
val actual = store.fetchContacts(MailLookup("[email protected]")).first() | ||
val expected = listOf(kimClay()) | ||
|
||
assertThat(actual, equalTo(expected)) | ||
|
31 changes: 29 additions & 2 deletions
31
library/src/main/java/com/alexstyl/contactstore/ContactPredicate.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
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