}
data classdata class AppListModelAppListModel(
valval applicationId: StringString,
valval displayName: StringString,
valval shortDescription: StringString,
valval iconUrl: StringString
)
J!-*( $.(+' .G.-G($)G%1G*(G*((*).2- G-**(G($.G++)/$/4?&/K
- < AppEntity $/. '!$.0)- (-&' ?*2 1 -<2 '.* 8) ) AppListModel
'..<2$/#.0. /*!/# AppEntity +-*+ -/$ .? AppEntity.Store )*/*)'4 8) .
loadAll() !0)/$*)/#/- /0-). )/$/$ .<0/$/#. loadListModels() !0)/$*)
/#/- /0-). AppListModel *% /.? loadListModels() #. @Query ))*//$*)/#/
- /0-).*)'4/# *'0().) 4 AppListModel<)**(2$''#++$'4+*0-/#/
/$)/* AppListModel *% /.!*-0.?# *)'4*)) /$*) /2 ) AppEntity )
AppListModel $./#/*0- loadListModels() ,0 -4,0 -$ ./# apps /' ?
*2<++* /#/$.+'4.'$./.<*-*/# -2$. *)'4) ./#$..0. /*!/# *1 -''
)/$/4/<)2*-&2$/#/# E'$./(* '.F$)./ >
packagepackage com.commonsware.room.misccom.commonsware.room.misc
importimport androidx.room.Roomandroidx.room.Room
importimport androidx.test.platform.app.InstrumentationRegistryandroidx.test.platform.app.InstrumentationRegistry
importimport androidx.test.ext.junit.runners.AndroidJUnit4androidx.test.ext.junit.runners.AndroidJUnit4
importimport com.natpryce.hamkrest.assertion.assertThatcom.natpryce.hamkrest.assertion.assertThat
importimport com.natpryce.hamkrest.equalTocom.natpryce.hamkrest.equalTo
importimport com.natpryce.hamkrest.hasSizecom.natpryce.hamkrest.hasSize
importimport com.natpryce.hamkrest.isEmptycom.natpryce.hamkrest.isEmpty
importimport org.junit.Testorg.junit.Test
importimport org.junit.runner.RunWithorg.junit.runner.RunWith
@RunWith(AndroidJUnit4AndroidJUnit4::classclass)
classclass AppEntityTestAppEntityTest {
privateprivate valval db = RoomRoom.inMemoryDatabaseBuilder(
InstrumentationRegistryInstrumentationRegistry.getInstrumentation().targetContext,
MiscDatabaseMiscDatabase::classclass.java
)
.build()
privateprivate valval underTest = db.apps()
@Test
funfun queryDisplayModels() {
assertThat(underTest.loadAll(), isEmpty)
assertThat(underTest.loadListModels(), isEmpty)
valval fdroid = AppEntityAppEntity(
applicationId = "org.fdroid.fdroid",
displayName = "F-Droid",
shortDescription = "An independent app store featuring open source Android apps",
fullDescription = "F-Droid is an installable catalogue of FOSS (Free and Open Source Software)
applications for the Android platform. The client makes it easy to browse, install, and keep track of
THE DAO OF ENTITIES
33
Published under the Creative Commons
Attribution-ShareAlike 4.0 International license.
Visit https://commonsware.com/licenses to learn more!