+1. Add the `jacoco` plugin to the `plugins` section. The complete section should look like:
```java
plugins {
- id 'java'
- id 'jacoco'
- }
-
- repositories {
- jcenter()
- mavenCentral()
- }
-
- dependencies {
- def junitVer = '5.7.1'
- testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: junitVer
- testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: junitVer
- testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '2.2'
- }
-
- test {
- useJUnitPlatform()
+ id "application";
+ id "jacoco";
}
```
- There are three frameworks being used here:
+ We will explain what JaCoCo is in a later section.
- * JUnit 5
- * Hamcrest
- * JaCoCo
+2. Add the testing library dependencies to the project. The following section should be added to the bottom of the build script:
- We will explain what each of these frameworks is doing as we go.
+ ```java
+ dependencies {
+ def junitVer = "5.8.2";
+ testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: junitVer;
+ testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: junitVer;
+ testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '2.2';
+ }
+ ```
-1. You may get some warnings in your project at this point. This is because your project is using libraries that Gradle has not yet downloaded. Build the project using <