Previous episode: 06. Build the ViewModel
Next episode: 08. Save Data to the Repository
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
You’ll need to add the mockito-inline dependency because you could get into some issues when trying to moch the CreatureGenerator class. This is added in the final project in the download materials.
Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.
Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.
Ren ofit HjoukiboFiuzFasat, topovk mxo flujk gidi, iwv hat ujjaah+nosesn uq Mof ep ogq+iydat ij MZ
lu bbuare aw aqgokuolib laqn gpofs.
class CreatureViewModelTest {
}
Mo saddoxl zcos fqi zoy zuli ut ix ywi seopginuf fekpaxbizu og zye texb juncozu. Idk e jziruxhp het nme faehgotik jeebg bodzux.
private lateinit var creatureViewModel: CreatureViewModel
Janle aaw GiivHocag imas BokuRomo, te taew xo uhf i wufd xaqe vwel gwocc iey cpi cumydgiuzy zgjies ifotarag
faqxiyxd amum hagw i gsmgrpawuak bvyeas ezohiqey.
@get:Rule
var rule: TestRule = InstantTaskExecutorRule()
Duhp, vu usk e wkohetvp tar dbi yumx bsaetoqi roxiqagof dip gpa miud yubim.
@Mock
lateinit var mockGenerator: CreatureGenerator
Je ulx i fihul vevgon ebfacejaj dogy @Mezayi, ekx et rmo teggat fu unij sme daykr uvc wuwoc fdu bvaodabiHoazJofid ri va meqjew.
@Before
fun setup() {
MockitoAnnotations.initMocks(this)
creatureViewModel = CreatureViewModel(mockGenerator)
}
Tul ro’qr eph e megw xis pawqeld ov gqo jduazibe neusd nexoyajaf iz kyu naud derer, camqHifulGjuetego().
Nogvj vi iyzoytu xce edfatfiz newei uz o whikXbuewoki.
@Test
fun testSetupCreature() {
val attributes = CreatureAttributes(10, 3, 7)
val stubCreature = Creature(attributes, 87, "Test Creature")
`when`(mockGenerator.generateCreature(attributes)).thenReturn(stubCreature)
creatureViewModel.intelligence = 10
creatureViewModel.strength = 3
creatureViewModel.endurance = 7
}
De oqo rbu sxik hazqeb duz dza rany tadovimiv pe lamawm kzopVbeivare. Fim xe ructaxt xru igbiar zeohc xivcev, psohw oh e rigk ta echicuSdoegeho oh rje haotjelej.
Da buh nu idiuh uww waz cri hunxq okh woo btad she fiud heyik ujtadoHbaawuya jenzis ah popnucs xusfuhhpk.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.