All language subtitles for 385 Testing edge cases by writing and fixing failing tests.en

af Afrikaans
ak Akan
sq Albanian
am Amharic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,870 --> 00:00:06,420 In the last video we added our new test to our state validator and in general one of the goals of the 2 00:00:06,420 --> 00:00:11,100 unit testing is that we should test our objects with all possible inputs. 3 00:00:11,100 --> 00:00:16,980 And while these may not be practical in all cases I think there is one more test that we could add to 4 00:00:16,980 --> 00:00:22,470 this file and that is to check what happens when we pass a no string to this method. 5 00:00:22,980 --> 00:00:29,190 However when we created the known empty string validator we haven't actually decided what should happen 6 00:00:29,220 --> 00:00:31,200 when the input string is no. 7 00:00:31,260 --> 00:00:36,900 So by writing these extra test we are actually looking at one edge case that we have not considered 8 00:00:36,900 --> 00:00:40,260 before and we could approach this in two ways. 9 00:00:40,440 --> 00:00:46,860 We could say that passing a new string is not about this scenario and we would expect the app to throw 10 00:00:46,860 --> 00:00:53,010 an assertion at runtime or we could decide that a new string should be accepted and that this method 11 00:00:53,010 --> 00:00:54,230 to return false. 12 00:00:54,270 --> 00:00:55,270 In this case. 13 00:00:55,470 --> 00:01:01,230 And for this specific case I propose that we take the second option and we allow unknown string to be 14 00:01:01,230 --> 00:01:01,970 passed. 15 00:01:01,980 --> 00:01:08,850 So what we are going to do is throw out our new test by copy pasting the previous method like this and 16 00:01:08,850 --> 00:01:12,300 here we can update that description to no string. 17 00:01:12,780 --> 00:01:20,850 And we are going to pass no two is valid and we want the expectation to be false and then we can run 18 00:01:20,940 --> 00:01:29,100 this test and in the console log we see that we get a narrow because we try to call is not empty on 19 00:01:29,150 --> 00:01:30,580 unknown object. 20 00:01:30,690 --> 00:01:33,910 So let's open the string money that are once again. 21 00:01:33,990 --> 00:01:44,580 And here we can fix this by adding a check that says if value is no then return false like this and 22 00:01:44,580 --> 00:01:47,070 then we can run the test once again 23 00:01:50,320 --> 00:01:53,530 and this time we can see that the test has passed. 24 00:01:53,710 --> 00:02:00,250 By the way this icon on Android Studio is still red but I have found that this is a bug in Android Studio 25 00:02:00,550 --> 00:02:06,430 and we can tell that the test is passed because this check mark is green over here. 26 00:02:06,430 --> 00:02:12,460 In summary we have written some tests for this class and this forced us to think about all the possible 27 00:02:12,490 --> 00:02:18,790 inputs and in the process of doing this we have discovered a problem when passing new values and to 28 00:02:18,790 --> 00:02:19,770 address this. 29 00:02:19,840 --> 00:02:26,290 We have written a failing test first and then we have fixed our known empty string validate or class 30 00:02:26,890 --> 00:02:30,030 which made our test go green again. 31 00:02:30,180 --> 00:02:36,430 And this is a process that is often used when writing tests because we can start by writing a failing 32 00:02:36,430 --> 00:02:42,490 test and then we can write the code that makes that test go green and the result of this is that our 33 00:02:42,490 --> 00:02:49,000 code is more robust and it also has better test coverage so you can consider using this approach as 34 00:02:49,000 --> 00:02:51,550 you write your own classes and tests. 35 00:02:51,550 --> 00:02:51,880 Okay. 36 00:02:51,910 --> 00:02:53,820 So let's continue on the next video. 3883

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.