Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,210 --> 00:00:04,330
If you write your tests first, then you'll be forced to write code that is easy to test.
2
00:00:04,770 --> 00:00:09,960
So the first step of test driven development is to identify a meaningful test cases from the requirements
3
00:00:10,290 --> 00:00:12,470
when the story adds a movie to its collection.
4
00:00:12,480 --> 00:00:15,840
We need to check if the story contains the movie that was just added.
5
00:00:17,400 --> 00:00:18,150
Testified.
6
00:00:19,540 --> 00:00:22,450
The store contains the movie after its added.
7
00:00:25,920 --> 00:00:28,560
If that test succeeds, then we know that our code works.
8
00:00:28,890 --> 00:00:33,030
The second thing we need to check for is if a movie gets removed after we sell it.
9
00:00:35,840 --> 00:00:37,670
Test if the movie gets removed.
10
00:00:41,500 --> 00:00:42,640
After being sold.
11
00:00:45,280 --> 00:00:50,140
And now in the event that someone tries to buy a movie that was already rented, we need to make sure
12
00:00:50,140 --> 00:00:57,010
the application throws an illegal state exception test for an illegal STD exception for selling a rented
13
00:00:57,010 --> 00:00:57,460
movie.
14
00:01:02,340 --> 00:01:07,560
The other two test cases should be fairly intuitive if someone rents a movie, we need to check if that
15
00:01:07,560 --> 00:01:11,160
movie becomes rented, test if the movie becomes rented.
16
00:01:15,460 --> 00:01:20,950
Otherwise, if someone returns a movie, we need to write a test that ensures the movie is available
17
00:01:20,950 --> 00:01:21,360
again.
18
00:01:24,150 --> 00:01:26,250
Test if the movie is available again.
19
00:01:29,170 --> 00:01:34,080
If all of the tests we write pass, we can rest assured that our code doesn't have any bugs.
20
00:01:34,930 --> 00:01:40,450
Now, you might be wondering why did I code the constructor getters and setters without unit testing
21
00:01:40,480 --> 00:01:41,120
them first?
22
00:01:41,740 --> 00:01:45,920
That's because they're always doing the same thing and testing them is meaningless.
23
00:01:45,940 --> 00:01:47,980
They don't offer meaningful logic.
24
00:01:49,060 --> 00:01:54,700
OK, that's all for part one, we've identified every meaningful test case and now we can start unit
25
00:01:54,700 --> 00:01:55,240
testing.
2447
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.