Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making SiteSTore open to allow mocking in androidTest. #2035

Merged
merged 2 commits into from
Jun 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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