1 00:00:00,000 --> 00:00:03,034 So now we've come quite a long way in our test journey. 2 00:00:03,034 --> 00:00:05,552 We covered core concepts of Unit testing, those 3 00:00:05,552 --> 00:00:07,546 foundations we saw in the first section. 4 00:00:07,546 --> 00:00:09,236 We also created a project to work with 5 00:00:09,236 --> 00:00:10,964 which could use JUnit and learned all 6 00:00:10,964 --> 00:00:13,096 about JUnit's API and operation. 7 00:00:13,096 --> 00:00:14,504 So let's take it to the next level 8 00:00:14,504 --> 00:00:16,979 now and laws and more advanced concepts. 9 00:00:16,979 --> 00:00:18,898 First up, we're going to look at Hamcrest. 10 00:00:18,898 --> 00:00:20,602 This is a powerful assertions library 11 00:00:20,602 --> 00:00:22,030 that comes shipped with JUnit. 12 00:00:22,030 --> 00:00:24,286 It allows you to write very easy to read assertions. 13 00:00:24,286 --> 00:00:26,674 To step your assertions up to second gear, 14 00:00:26,674 --> 00:00:28,354 we're also going to introduce you to Mock 15 00:00:28,354 --> 00:00:30,866 Objects thing and take a look at Mockita, the most 16 00:00:30,866 --> 00:00:33,415 popular framework on the java scene currently. 17 00:00:33,415 --> 00:00:35,864 For now, we've just seen basic tests which 18 00:00:35,864 --> 00:00:37,676 will test things in a functional way. 19 00:00:37,676 --> 00:00:39,716 So here's a method or test object, give 20 00:00:39,716 --> 00:00:42,188 it some input parameters or fields invoke a 21 00:00:42,188 --> 00:00:44,578 test method, and then check the results. 22 00:00:44,578 --> 00:00:45,980 Now if you have objects which 23 00:00:45,980 --> 00:00:47,604 interact with each other though. So for 24 00:00:47,604 --> 00:00:50,382 example, Object A calls out to Object B, then 25 00:00:50,396 --> 00:00:52,162 you're going to want to control the way of testing 26 00:00:52,162 --> 00:00:54,668 this. And this is what Mock Objects are all about. 27 00:00:54,668 --> 00:00:56,288 That's going to be fun. 28 00:00:56,288 --> 00:00:58,688 Finally, we'll touch upon code coverage too. 29 00:00:58,688 --> 00:01:00,836 It's an important benchmark the Dev teams like to 30 00:01:00,836 --> 00:01:02,758 use as a measure of code quality, so it's 31 00:01:02,758 --> 00:01:04,364 useful to have a run through of that and 32 00:01:04,364 --> 00:01:05,912 see it in action so you can pass those 33 00:01:05,912 --> 00:01:08,374 quality gates at the end of your development pieces. 34 00:01:08,374 --> 00:01:10,124 So let's jump in now and dig into 35 00:01:10,124 --> 00:01:12,000 the more advanced side of Unit testing.