All language subtitles for 010 Quidditch Game – Part 5 (Tasks 1 – 3)_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
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 Download
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
ko Korean
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

And this solution, we're going to write some unit tests, remember, the first step and test driven

development is to identify meaningful test cases and for the sake of expediency, already did that part

for you.

The first thing we're going to test is if the simulation can find the placeholder in each play.

So inside game test Java, I'm going to write a unit test name to get placeholder test.

Public void get placeholder test.

And before we can do anything, we have to set up a before method that sets up our game object.

Inside the method set up the game object, as you did in main.

Let me do some cleaning up, remove the two variables and put the objects in directly.

OK, now inside the unit test, we're going to assert equals.

This test expects the value chaser when we call game get placeholder.

In person to it, a play that equals the placeholder chaser chaser gets the next pass.

And now inside game Java write code to make the test fail, I'll get a function that returns a string

called Get Placeholder.

And the unit test implies we need to pass in a string into our function again, it's really nice that

our test determines the code that we write.

And for now, we'll make the test failed by returning hello.

The test fails now.

We write code to make it pass.

I told you to research how to get a string between two characters because we need to get the string

between each pointy brackets.

I'm not going to pretend like I knew how to do this off the top of my head because I remember a good

developer doesn't memorize code.

A good developer knows how to use the Internet to read documentation and find resources.

And I'm going to show you how I did my research.

I just looked up how to get a string between two characters.

OK, the first link looks good, I'll have a look around for the best answer.

I don't like this one just because I don't want to have to import an Apache Commons library to perform

a simple task.

There must be something that we can just use out of the box.

OK, this answer looks really good.

It seems that we can get a substring that starts at a certain inducts and ends at another.

Normally at this point, I would look up the documentation just to have a little bit more information

about this method.

This method is from the string class because they're calling it from a string object.

So I can just look up string documentation Java.

JDK 11.

I'll look up Substring and keep going until I find my method.

Let me add a bracket to filter out some results and perfect.

Here it is.

So the substring starts at the index, you specify, and the end index is whatever you passan minus

one.

I know exactly how this works.

Now I'm going to do it incorrectly.

The first time for the sake of making a test that fails, I'll go back to the method and from the play

string, I'm going to get the substring.

That starts at the index of.

The pointy bracket character and ends at the index of the other pointy bracket character.

Run the test now, and it fails an expected chasers, but we got back chasers with a pointy bracket

in the beginning.

Look back at the documentation, it says the substring is starts at the index, we specify, and we

want to start at the index that comes after the bracket.

So we'll say plus one.

Run the test.

And now it works.

Now, you might be wondering by that logic, shouldn't the substring also include the second pointy

bracket?

But look back at the documentation.

Where the substring ends is whatever you pass in minus one.

So our substring stops one index before the one we specified.

This is why it's really important to read the documentation if you're not sure how a method works.

Just take a few seconds to check out the documentation anyways.

We spend enough time on this onto the second test case.

We need to check if the simulation can replace the placeholder that it finds with a value.

So inside game test Java, I'm going to write a unit test named to replace Placeholder Test.

We'll make an assertion.

And this test expects the sentence Katie gets the next pass.

From a function we're going to call game dot, replace Placeholder.

That receives the play Chaser gets the next pass.

We're going to tell replace Placeholder what the placeholder is.

And the value we want to replace the placeholder with Katie.

And now inside game Java write code to make the test fail.

I'm going to create a function that returns a string called Replace Placeholder.

And the unit test implies we need to pass three parameters into our function.

String play.

String, placeholder and string value.

Again, pretty cool that our test determines the code that we should write, and for now we'll make

the test fail by returning.

Hello?

OK, the test fails now we need to write code to make it pass.

I told you to research how to replace a string in a placeholder with another value.

So I'll do just that.

How to replace part of a string in Java.

Take a look around.

Wow, I like this answer.

It's short and simple, let's just make sure we look up what replaced does exactly before we use it.

I'll go to the documentation.

Command control for Windows and look up, replace and cool takes two arguments and replaces all the

occurrences of the first argument with the second one.

Fair enough, back to the code from the play String Alchol Replace.

And we will replace all occurrences of the placeholder with the value.

And the test fails because we also have to replace these two pointy brackets.

So I'm going to add those to the first parameter.

Let's test it out.

And our test passes.

Can this code be any simpler?

Not really.

I think we're done in the next video, we'll pick up the remaining tasks.

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