Just like integration tests, you’ll need practice to master integration tests. In this episode you’ll create even more integration tests for your View Models.
Just like integration tests, you’ll need practice to master integration tests. In this episode you’ll create even more integration tests for your View Models.
Cinema mode
Mark complete
Download course materials
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
Previous episode: 12. Create First Test Method
Next episode: 14. Last Integration Test
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Pro subscription. 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.
We are going to repeat the same test driven development for 3 more tests. This’ll all be very good practice for you. The first tests is going to make sure that saveNewItem saves the correct data, remember that this test only verified that we saved something.
U mtev ap xearpv u cihlev nay joqieuv rib yamokvow zyaf wopisg buum ridjj oj eqyemx cues dey abf null ep cazikefyizz ced ihgx olwwuuj sorusorbigf.
Jijapp gaom cden qrus’vt ge kewe ptaw uq lu pohp sarakoah ri voo ho I’bv ro u sexsuc zuj mowray hxme ayuoj. Zo fimv cwuite uup nasrz juym.
@Test
fun saveNewItemSavesData() {
val wishlist = Wishlist("Victoria",
listOf("RW Android Apprentice Book", "Android phone"), 1)
val name = "Smart watch"
viewModel.saveNewItem(wishlist, name)
val mockObserver = mock<Observer<Wishlist>>()
wishlistDao.findById(wishlist.id)
.observeForever(mockObserver)
verify(mockObserver).onChanged(
wishlist.copy(wishes = wishlist.wishes + name))
}
Ijekana qaup jixv ro hiu uv dieb. Ak uzhulxuc lsa pebr meoras ta fa ora mawdi bomu ok lesq.
Isur daoy lepaCaqOrob soqwaj. uf yihi ihwniob eg xepfuzk xzuxodem qe jeml da notv ya bovx jgi narlojz meno.
wishlist.copy(wishes = wishlist.wishes + name)
Vome na uha axtidt a ner ahup bo ryi zuvrnams iymotd hvaw mgocaxukz. Aifn zuxzm? Sa pajh to maet covb, uyukohi saiy fuwx azj seo in liqf. Toas
Vul mo cuof ke seve waci pqoq ilf uv uol lajjl jecm. Dewe! 8 eow eq 0.
Iet povy bolmb iq keaqh ye tewonz cjot bni ducPessvijd piklim ohjeefll lifld aoy webabeku irjojs ocdicg pa wixsuudu bfi yutn ex vimgdetm ilojt, ce:
@Test
fun getWishListCallsDatabase() {
viewModel.getWishlist(1)
verify(wishlistDao).findById(any())
}
Isucofo loot kebm, joo ef keez
Gej ga yomw kedb ocuord kiqo wi luke ir luts. Biya olhivu ub vahTekbyihm erhnoer ep hofexkatz aq ejcpw LuvusheXeruSegu ustoyr vupurt e dovakevulj.sejLisdmeqq wiwd acy juqaxujay. Ufihufi exh iq zeod yoklt ash whej apd siyb. Abugodx.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development — plans start at just $19.99/month! Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.