All language subtitles for 387 The setUp method and testing date formatting with locales.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

Original subtitles

We can now add more tests to this file and our next focus is the date method that we use to format a

date.

So here we cannot a new group.

And here we can name it date and we're gonna give it a body like this and then we could add a new test

to check that the correct date is formatted so I cannot test with 20 19 0 8 twelve as a description

to mean that the logos 2019 and then the method body as usual.

And here I can right expect and then four month date.

And here I need to pass up the date time with Twenty 19 eight twelve and the expected value in these

cases twelve logos 29 things like this.

And at this stage I could run this test and I can see that I get an error because the actual value that

was return is different from my expected value.

And in fact this expected value is only valid if I configured the default locale to G.B. and instead

the test has run with the U.S. default lockout.

So when we write tests they use date formatting.

We need to be very careful because different systems might have different default locales.

So we need a way of choosing what locale to use when we run tests that rely on data for mapping and

to do that.

I'm going to use a new method which is called set up and set up takes a closure that is executed before

each test.

In this group is run.

And this makes it a very useful method for code that needs to be executed for each test.

OK.

So what I want to do next is to configure the default to look out for my test and I can do this by typing

I and the L which I need to import from the I A.L. package and then I'm going to set the default locale

to E and on the score G.B. and I also need to call initialize date for my thing and this is also a method

that I need to import from here and here I can typing I and the l the default locale like this and this

is a method that returns a future.

So I need to type in I wait here and also sink in here.

And now that I made this change I should remain this group to date with G.B. loco because all the tests

that will run here will use that GBM locale.

And now I can run the tests again and this time I got the success by the way I have said that we can

use this setup method to execute some common code before each test is run.

And this means that here we go that another test for example with a different date of the 16 of August

and I can update this here.

And in this case we could run this test again and this would also succeed because the correct lock out

will be set up in the setup method.

So if we wanted to ensure that our code works well with different locales we could copy paste this entire

group and adjust all the values accordingly.

OK.

So let's continue on the next video.

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