1 00:00:00,000 --> 00:00:02,049 [No Audio] 2 00:00:02,049 --> 00:00:03,516 In this video we're going to review the project 3 00:00:03,516 --> 00:00:05,233 structure that was created for us by the 4 00:00:05,233 --> 00:00:06,511 Quickstart archetype in the previous 5 00:00:06,511 --> 00:00:08,141 video and just have a bit of an overview 6 00:00:08,141 --> 00:00:09,752 of it so we know what goes where. 7 00:00:09,752 --> 00:00:12,584 So in the myapp generated Project you can 8 00:00:12,584 --> 00:00:15,262 see here we have the src folder and directly 9 00:00:15,262 --> 00:00:17,336 underneath the src folder we have two 10 00:00:17,336 --> 00:00:20,086 subdirectories, we have main and test. 11 00:00:20,086 --> 00:00:22,616 So in src, main, java, this is where 12 00:00:22,616 --> 00:00:24,896 the production code for the application would live. 13 00:00:24,896 --> 00:00:26,984 Src, main, resources would hold any class of 14 00:00:26,984 --> 00:00:29,816 resources it needed to use in production and 15 00:00:29,816 --> 00:00:31,282 as a sibling folder to that. In other 16 00:00:31,282 --> 00:00:33,665 words, on the same level we have this test 17 00:00:33,665 --> 00:00:37,556 subdirectory and again we have java underneath there. 18 00:00:37,556 --> 00:00:42,476 So we've got src, main, java which is where 19 00:00:42,476 --> 00:00:44,576 our production source code is going to live. 20 00:00:44,576 --> 00:00:48,632 And then we have src, test, java which is 21 00:00:48,632 --> 00:00:51,266 where our test source code is going to live. 22 00:00:51,266 --> 00:00:53,434 And you'll notice as well IntelliJ 23 00:00:53,434 --> 00:00:54,788 color codes these for us. 24 00:00:54,788 --> 00:00:56,290 So you can see here we've got the blue 25 00:00:56,290 --> 00:00:58,195 directory which means the production source code 26 00:00:58,195 --> 00:01:00,764 folder. And here we can see we've got the 27 00:01:00,764 --> 00:01:03,514 green directory which means test source folder. 28 00:01:03,514 --> 00:01:06,586 Now it's important that we separate these two source 29 00:01:06,586 --> 00:01:08,746 trees apart from each other, so the production source 30 00:01:08,746 --> 00:01:10,952 code lives separately from the test source code. 31 00:01:10,952 --> 00:01:13,222 This is so that it makes it easy to compile 32 00:01:13,222 --> 00:01:16,058 and bundle the different source sets as is needed. 33 00:01:16,058 --> 00:01:18,476 But also while we're on the subject of separation, we 34 00:01:18,476 --> 00:01:20,624 also need to ensure that the junit dependency which 35 00:01:20,624 --> 00:01:23,523 we've brought in here is a test scoped dependency. 36 00:01:23,523 --> 00:01:25,457 So if we just put this in here 37 00:01:25,457 --> 00:01:30,206 [No Audio] 38 00:01:30,206 --> 00:01:32,780 and go for XML tag, we can see here we've got scope 39 00:01:32,780 --> 00:01:37,713 and then we can just go down and insert test. 40 00:01:37,713 --> 00:01:41,136 Now you won't see anything change here because this 41 00:01:41,136 --> 00:01:43,622 is a list of the complete set of libraries this 42 00:01:43,622 --> 00:01:46,674 project references, regardless of the class path type. 43 00:01:46,674 --> 00:01:49,946 However, by putting this scope test tag in here, we're 44 00:01:49,946 --> 00:01:52,337 ensuring that junit will only ever be used and 45 00:01:52,337 --> 00:01:54,779 accessible to code, which is in this src, test, java 46 00:01:54,779 --> 00:01:56,016 folder. In other words, it'll never be 47 00:01:56,016 --> 00:01:57,794 bundled with our production applications. 48 00:01:57,794 --> 00:02:00,602 It won't, for example, exist in a Webinf 49 00:02:00,602 --> 00:02:02,556 Lib directory inside a wall file if we 50 00:02:02,556 --> 00:02:04,968 were creating web applications to take one example. 51 00:02:04,968 --> 00:02:07,046 So this scope test really means that it's 52 00:02:07,046 --> 00:02:09,395 only ever used for the test source code, 53 00:02:09,395 --> 00:02:11,076 and that's exactly what we want as well. 54 00:02:11,076 --> 00:02:13,126 Similarly, when we introduce Mockito later in 55 00:02:13,127 --> 00:02:14,436 the course, we'd also put this in 56 00:02:14,436 --> 00:02:16,680 as a test scope dependency as well. And 57 00:02:16,680 --> 00:02:19,716 finally, because junit depends on Hamcrest to be 58 00:02:19,716 --> 00:02:22,536 able to function, then Hamcrest is also scoped as 59 00:02:22,536 --> 00:02:25,010 a test dependencies, so it inherits the same scope 60 00:02:25,010 --> 00:02:26,880 as the dependency that's pulling it in. 61 00:02:26,880 --> 00:02:28,764 So while this stuff about dependency scopes might 62 00:02:28,764 --> 00:02:31,032 not seem that interesting at this current time, 63 00:02:31,032 --> 00:02:32,580 it's really important that you get the right 64 00:02:32,580 --> 00:02:34,896 scope whenever be importing test libraries to make 65 00:02:34,896 --> 00:02:36,864 sure that you don't accidentally include those test 66 00:02:36,864 --> 00:02:39,360 libraries in your production source code. Anyway 67 00:02:39,360 --> 00:02:41,460 that was a nice overview of the generated project 68 00:02:41,460 --> 00:02:43,116 structure and now we've got a good idea where 69 00:02:43,116 --> 00:02:44,842 we can find things so let's move forward with 70 00:02:44,856 --> 00:02:47,415 this and start using JUnit in the next videos.