Afrikaans
Akan
Albanian
Amharic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
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
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.