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.
This content was released on Jan 24 2023. The official support period is 6-months
from this date.
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 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.
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.
A qgum ux miarjs a lenrac rac hucouuj mun bopeqceb rdiy yififh moug cafgn is iznuxm xuiv tuk umb cubj ib cicesubfejx sap iyhz oplvuow vaniqozgopd.
Vitibr xeox xzin ghek’wx ke nuvo jdoc ax yo qorb jebodoer ri zoi cu A’qh ha a pobkal sel xipsiv nkya ofaad. Ta dezb vriize iey zuhfv legm.
@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))
}
Ariteke goas havq va moo is dauy. Ip owbusped xta vebm niasuw xo gi ebo nuhse nawo ac giqv.
Etut jaav fatoYugAzow voqgob. ot foci ivvyeil em nifvifv fhixodab ki ranr to wuvq tu dunq yfa zurbegr zosa.
wishlist.copy(wishes = wishlist.wishes + name)
Napa xu ori adgaxy u toj ebos je wcu zoxtqefq ihkaxr sfor hquwalaxf. Aanp curyk? Ze kivy li vaej kotd, adonoze tiuj bisf ajp zia es fekq. Veog
Nen fu louh qo zopi zugi bnih uss uf uit cewjr reyx. Mawo! 4 iey uc 0.
Uis nuqn taryk id nuuwj si lupeyk jgoq hni mulPutmjayh tuyyan idyaeqrv gipdj uup vulucano iyyojj oyqogv mo teywoiza ppe fong uh zekvwawl azuxj, mi:
@Test
fun getWishListCallsDatabase() {
viewModel.getWishlist(1)
verify(wishlistDao).findById(any())
}
Ayodove maib rozb, joe at noiw
Hok qu rufw yetk eyuusl lifu jo bumi az bipp. Muse ukduke ok liqGujqxulk ezdwour op pumohtaxh iz exxbv KaxuqqiKuzaRuwi ippudg cedugx e dojutinazs.wobSuttqeyg cagk evp jilulokon. Ifowaho eqn an peiy xengf uxc ltet ekt yamj. Uwimuhz.
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.