Skip to content

Commit 69403c1

Browse files
committed
Add null checks and document them
1 parent a3ac17b commit 69403c1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/OutputDirectoryProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@
3030
public interface OutputDirectoryProvider {
3131

3232
/**
33-
* {@return the root directory for all output files}
33+
* {@return the root directory for all output files; never {@code null}}
3434
*/
3535
Path getRootDirectory();
3636

3737
/**
3838
* Create an output directory for the supplied test descriptor.
3939
*
4040
* @param testDescriptor the test descriptor for which to create an output
41-
* directory
41+
* directory; never {@code null}
4242
* @return the output directory
4343
* @throws IOException if the output directory could not be created
4444
*/

junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/HierarchicalOutputDirectoryProvider.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.util.function.Supplier;
1919
import java.util.regex.Pattern;
2020

21+
import org.junit.platform.commons.util.Preconditions;
2122
import org.junit.platform.engine.TestDescriptor;
2223
import org.junit.platform.engine.UniqueId.Segment;
2324
import org.junit.platform.engine.reporting.OutputDirectoryProvider;
@@ -42,6 +43,8 @@ class HierarchicalOutputDirectoryProvider implements OutputDirectoryProvider {
4243

4344
@Override
4445
public Path createOutputDirectory(TestDescriptor testDescriptor) throws IOException {
46+
Preconditions.notNull(testDescriptor, "testDescriptor must not be null");
47+
4548
List<Segment> segments = testDescriptor.getUniqueId().getSegments();
4649
Path relativePath = segments.stream() //
4750
.skip(1) //

0 commit comments

Comments
 (0)