-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix test without relying on Gradle's --debug
- Loading branch information
1 parent
151cd36
commit f44ae01
Showing
3 changed files
with
46 additions
and
15 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...form-reporting/src/testFixtures/java/org/junit/platform/reporting/testutil/FileUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2015-2024 the original author or authors. | ||
* | ||
* All rights reserved. This program and the accompanying materials are | ||
* made available under the terms of the Eclipse Public License v2.0 which | ||
* accompanies this distribution and is available at | ||
* | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
*/ | ||
|
||
package org.junit.platform.reporting.testutil; | ||
|
||
import java.io.IOException; | ||
import java.io.UncheckedIOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
|
||
public class FileUtils { | ||
|
||
public static Path findPath(Path rootDir, String syntaxAndPattern) { | ||
var matcher = rootDir.getFileSystem().getPathMatcher(syntaxAndPattern); | ||
try (var files = Files.walk(rootDir)) { | ||
return files.filter(matcher::matches).findFirst() // | ||
.orElseThrow(() -> new AssertionError( | ||
"Failed to find file matching '%s' in %s".formatted(syntaxAndPattern, rootDir))); | ||
} | ||
catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters