Skip to content

Commit

Permalink
Merge pull request #2035 from wordpress-mobile/try/fix-site-store-con…
Browse files Browse the repository at this point in the history
…nected-tests

Making SiteSTore open to allow mocking in androidTest.
  • Loading branch information
develric authored Jun 24, 2021
2 parents 81be0ed + 24910cf commit c96baf1
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,12 @@ import javax.inject.Singleton

/**
* SQLite based only. There is no in memory copy of mapped data, everything is queried from the DB.
*
* NOTE: This class needs to be open because it's mocked in android tests in the WPAndroid project.
* TODO: consider adding https://kotlinlang.org/docs/all-open-plugin.html
*/
@Singleton
class SiteStore
open class SiteStore
@Inject constructor(
dispatcher: Dispatcher?,
private val postSqlUtils: PostSqlUtils,
Expand Down Expand Up @@ -938,8 +941,11 @@ class SiteStore

/**
* Obtains the site with the given (local) id and returns it as a [SiteModel].
*
* NOTE: This method needs to be open because it's mocked in android tests in the WPAndroid project.
* TODO: consider adding https://kotlinlang.org/docs/all-open-plugin.html
*/
fun getSiteByLocalId(id: Int): SiteModel? {
open fun getSiteByLocalId(id: Int): SiteModel? {
val result = siteSqlUtils.getSitesWithLocalId(id)
return if (result.isNotEmpty()) {
result[0]
Expand Down

0 comments on commit c96baf1

Please sign in to comment.