Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
For this solution, we're gonna cover tasks two and three.
Going back to the third test case, we need to write a unit test that expects cell movie to throw an
exception if a movie has already been rented.
So here I can write a unit test that expects an illegal state exception.
Test expected.
And it expects an illegal state exception.
DECLASSE.
The unit test is called Movie Night in Stock.
First, I'll rent The Godfather.
And then I'll try to sell The Godfather.
If I run the test now.
It fails, it's expecting the test to throw in a legal state exception, but it isn't.
And so now we need to make the test pass by throwing an illegal -- exception from sell movie.
If the movie is already rented.
Throw an illegal STD exception.
Rerun the test and perfect.
And just have a look at how clean and elegant the code is, when you write tests, before you write
code, you're being forced to write code that is easy to test.
At the same time, code that is easy to test won't get any bugs.
And now what I'm going to do is run every single test.
They all pass, which means the code inside Staudt Java doesn't have any bugs.
And before we wrap up, just I want you to really appreciate how polished our code is.
Compared the old code with the new code in the old code, the functions were massive, this function
here is impossible to test.
So if you get a bug here, it's going to be really hard to fix.
In general, this is not good coding, but with unit testing, our code is a lot cleaner and immune
to bugs.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.