1212import java .nio .file .Files ;
1313import java .nio .file .Path ;
1414import java .util .List ;
15+ import java .util .Objects ;
1516
1617import static org .junit .jupiter .api .Assertions .assertEquals ;
18+ import static org .junit .jupiter .api .Assertions .assertFalse ;
1719import static org .junit .jupiter .api .Assertions .assertNotNull ;
1820import static org .junit .jupiter .api .Assertions .assertTrue ;
1921
@@ -38,12 +40,12 @@ void checkTaskDefaultsItsProjectRootToTheApplyingProject() {
3840 var task = (PruneCheckTask ) project .getTasks ().getByName ("pruneCheck" );
3941
4042 assertEquals (project .getProjectDir (), task .getProjectRoot ().get ().getAsFile ());
41- assertEquals ( Boolean . FALSE , task .getIgnoreFailures ().get ());
43+ assertFalse ( task .getIgnoreFailures ().get ());
4244 assertEquals ("terminal" , task .getFormat ().get ());
4345 assertEquals (List .of (), task .getExcludes ().get ());
4446 assertEquals (new File (project .getProjectDir (), "prune-baseline.txt" ), task .getBaseline ().get ().getAsFile ());
45- assertEquals ( Boolean . TRUE , task .getTestReferences ().get ());
46- assertEquals ( Boolean . FALSE , task .getExplain ().get ());
47+ assertTrue ( task .getTestReferences ().get ());
48+ assertFalse ( task .getExplain ().get ());
4749 assertEquals ("verification" , task .getGroup ());
4850 }
4951
@@ -58,7 +60,7 @@ void fixTaskDefaultsItsProjectRootAndFormat() {
5860 assertEquals ("terminal" , task .getFormat ().get ());
5961 assertEquals (List .of (), task .getExcludes ().get ());
6062 assertEquals (new File (project .getProjectDir (), "prune-baseline.txt" ), task .getBaseline ().get ().getAsFile ());
61- assertEquals ( Boolean . TRUE , task .getTestReferences ().get ());
63+ assertTrue ( task .getTestReferences ().get ());
6264 }
6365
6466 @ Test
@@ -71,11 +73,11 @@ void baselineTaskDefaultsItsFileAndTestReferences() {
7173 assertEquals (project .getProjectDir (), task .getProjectRoot ().get ().getAsFile ());
7274 assertEquals (List .of (), task .getExcludes ().get ());
7375 assertEquals (new File (project .getProjectDir (), "prune-baseline.txt" ), task .getBaseline ().get ().getAsFile ());
74- assertEquals ( Boolean . TRUE , task .getTestReferences ().get ());
76+ assertTrue ( task .getTestReferences ().get ());
7577 }
7678
7779 @ Test
78- void checkTaskRunsWithTheConfigurationCacheEnabled (@ TempDir Path projectDir ) throws Exception {
80+ void checkTaskRunsWithTheConfigurationCacheEnabled (@ TempDir Path projectDir ) throws IOException {
7981 Files .writeString (projectDir .resolve ("settings.gradle" ), "rootProject.name = 'cc-probe'\n " ,
8082 StandardCharsets .UTF_8 );
8183 Files .writeString (projectDir .resolve ("build.gradle" ), "plugins { id 'com.patbaumgartner.prune-java' }\n " ,
@@ -92,7 +94,7 @@ void checkTaskRunsWithTheConfigurationCacheEnabled(@TempDir Path projectDir) thr
9294 }
9395
9496 @ Test
95- void checkTaskRejectsAnUnknownFormat (@ TempDir Path projectDir ) throws Exception {
97+ void checkTaskRejectsAnUnknownFormat (@ TempDir Path projectDir ) throws IOException {
9698 Files .writeString (projectDir .resolve ("settings.gradle" ), "rootProject.name = 'format-probe'\n " ,
9799 StandardCharsets .UTF_8 );
98100 Files .writeString (projectDir .resolve ("build.gradle" ),
@@ -111,7 +113,8 @@ void checkTaskRejectsAnUnknownFormat(@TempDir Path projectDir) throws Exception
111113 }
112114
113115 @ Test
114- void baselineTaskRecordsTheFindingsAndCheckThenPassesWithThemSuppressed (@ TempDir Path projectDir ) throws Exception {
116+ void baselineTaskRecordsTheFindingsAndCheckThenPassesWithThemSuppressed (@ TempDir Path projectDir )
117+ throws IOException {
115118 Files .writeString (projectDir .resolve ("settings.gradle" ), "rootProject.name = 'baseline-probe'\n " ,
116119 StandardCharsets .UTF_8 );
117120 Files .writeString (projectDir .resolve ("build.gradle" ), "plugins { id 'com.patbaumgartner.prune-java' }\n " ,
@@ -140,7 +143,7 @@ void baselineTaskRecordsTheFindingsAndCheckThenPassesWithThemSuppressed(@TempDir
140143
141144 @ Test
142145 void baselineTaskRunsAgainWhenTheSourcesChangeEvenThoughItsOnlyDeclaredInputsDidNot (@ TempDir Path projectDir )
143- throws Exception {
146+ throws IOException {
144147 Files .writeString (projectDir .resolve ("settings.gradle" ), "rootProject.name = 'rerun-probe'\n " ,
145148 StandardCharsets .UTF_8 );
146149 Files .writeString (projectDir .resolve ("build.gradle" ), "plugins { id 'com.patbaumgartner.prune-java' }\n " ,
@@ -159,7 +162,7 @@ void baselineTaskRunsAgainWhenTheSourcesChangeEvenThoughItsOnlyDeclaredInputsDid
159162 }
160163
161164 @ Test
162- void tasksHonourAnExplicitBaselineFileAndTestReferences (@ TempDir Path projectDir ) throws Exception {
165+ void tasksHonourAnExplicitBaselineFileAndTestReferences (@ TempDir Path projectDir ) throws IOException {
163166 Files .writeString (projectDir .resolve ("settings.gradle" ), "rootProject.name = 'options-probe'\n " ,
164167 StandardCharsets .UTF_8 );
165168 Files .writeString (projectDir .resolve ("build.gradle" ), """
@@ -194,7 +197,7 @@ void tasksHonourAnExplicitBaselineFileAndTestReferences(@TempDir Path projectDir
194197 }
195198
196199 @ Test
197- void checkTaskTurnsAMalformedBaselineIntoABuildFailure (@ TempDir Path projectDir ) throws Exception {
200+ void checkTaskTurnsAMalformedBaselineIntoABuildFailure (@ TempDir Path projectDir ) throws IOException {
198201 Files .writeString (projectDir .resolve ("settings.gradle" ), "rootProject.name = 'malformed-probe'\n " ,
199202 StandardCharsets .UTF_8 );
200203 Files .writeString (projectDir .resolve ("build.gradle" ), "plugins { id 'com.patbaumgartner.prune-java' }\n " ,
@@ -216,7 +219,7 @@ private static GradleRunner runner(Path projectDir, String... arguments) {
216219
217220 private static void writeSource (Path projectDir , String relativePath , String content ) throws IOException {
218221 var file = projectDir .resolve (relativePath );
219- Files .createDirectories (file .getParent ());
222+ Files .createDirectories (Objects . requireNonNull ( file .getParent () ));
220223 Files .writeString (file , content , StandardCharsets .UTF_8 );
221224 }
222225
0 commit comments