Skip to content

Commit

Permalink
Adhere to project coding and style guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Feb 24, 2025
1 parent 02cd2f6 commit 6804dd9
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,17 @@ private static class ExecutionTimeoutException extends JUnitException {

/**
* The thread factory used for preemptive timeout.
* <p>
* The factory creates threads with meaningful names, helpful for debugging purposes.
*
* <p>The factory creates threads with meaningful names, helpful for debugging
* purposes.
*/
private static class TimeoutThreadFactory implements ThreadFactory {
private static final AtomicInteger threadNumber = new AtomicInteger(1);

@Override
public Thread newThread(Runnable r) {
return new Thread(r, "junit-timeout-thread-" + threadNumber.getAndIncrement());
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

/**
* Builder for {@link AssertionFailedError AssertionFailedErrors}.
* <p>
* Using this builder ensures consistency in how failure message are formatted
*
* <p>Using this builder ensures consistency in how failure message are formatted
* within JUnit Jupiter and for custom user-defined assertions.
*
* @since 5.9
Expand Down Expand Up @@ -51,8 +51,8 @@ private AssertionFailureBuilder() {

/**
* Set the user-defined message of the assertion.
* <p>
* The {@code message} may be passed as a {@link Supplier} or plain
*
* <p>The {@code message} may be passed as a {@link Supplier} or plain
* {@link String}. If any other type is passed, it is converted to
* {@code String} as per {@link StringUtils#nullSafeToString(Object)}.
*
Expand Down Expand Up @@ -202,4 +202,5 @@ private static String getClassName(Object obj) {
return (obj == null ? "null"
: obj instanceof Class ? getCanonicalName((Class<?>) obj) : obj.getClass().getName());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ default void publishEntry(String value) {

/**
* Publish the supplied file and attach it to the current test or container.
* <p>
* The file will be copied to the report output directory replacing any
*
* <p>The file will be copied to the report output directory replacing any
* potentially existing file with the same name.
*
* @param file the file to be attached; never {@code null} or blank
Expand All @@ -108,8 +108,8 @@ default void publishFile(Path file, MediaType mediaType) {
/**
* Publish the supplied directory and attach it to the current test or
* container.
* <p>
* The entire directory will be copied to the report output directory
*
* <p>The entire directory will be copied to the report output directory
* replacing any potentially existing files with the same name.
*
* @param directory the file to be attached; never {@code null} or blank
Expand Down Expand Up @@ -142,8 +142,8 @@ default void publishDirectory(Path directory) {
/**
* Publish a file or directory with the supplied name and media type written
* by the supplied action and attach it to the current test or container.
* <p>
* The {@link Path} passed to the supplied action will be relative to the
*
* <p>The {@link Path} passed to the supplied action will be relative to the
* report output directory, but it's up to the action to write the file.
*
* @param name the name of the file to be attached; never {@code null} or
Expand All @@ -161,8 +161,8 @@ default void publishFile(String name, MediaType mediaType, ThrowingConsumer<Path
/**
* Publish a directory with the supplied name written by the supplied action
* and attach it to the current test or container.
* <p>
* The {@link Path} passed to the supplied action will be relative to the
*
* <p>The {@link Path} passed to the supplied action will be relative to the
* report output directory and point to an existing directory, but it's up
* to the action to write files to it.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ default void publishReportEntry(String value) {
/**
* Publish a file with the supplied name written by the supplied action and
* attach it to the current test or container.
* <p>
* The file will be resolved in the report output directory prior to
*
* <p>The file will be resolved in the report output directory prior to
* invoking the supplied action.
*
* @param name the name of the file to be attached; never {@code null} or
Expand All @@ -388,8 +388,8 @@ default void publishReportEntry(String value) {
/**
* Publish a directory with the supplied name written by the supplied action
* and attach it to the current test or container.
* <p>
* The directory will be resolved and created in the report output directory
*
* <p>The directory will be resolved and created in the report output directory
* prior to invoking the supplied action.
*
* @param name the name of the directory to be attached; never {@code null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ public class MediaType {

/**
* Parse the given media type value.
* <p>
* Must be valid according to
*
* <p>Must be valid according to
* <a href="https://tools.ietf.org/html/rfc2045">RFC 2045</a>.
*
* @param value the media type value to parse; never {@code null}
Expand Down Expand Up @@ -142,8 +142,9 @@ public String toString() {

@Override
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass())
if (o == null || getClass() != o.getClass()) {
return false;
}
MediaType that = (MediaType) o;
return Objects.equals(this.value, that.value);
}
Expand All @@ -152,4 +153,5 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hashCode(value);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import org.apiguardian.api.API;

/**
* Represents a resource on the classpath.
* {@code Resource} represents a resource on the classpath.
*
* @since 1.11
* @see ReflectionSupport#findAllResourcesInClasspathRoot(URI, Predicate)
* @see ReflectionSupport#findAllResourcesInPackage(String, Predicate)
Expand All @@ -33,29 +34,33 @@
public interface Resource {

/**
* Get the resource name.
* <p>
* The resource name is a {@code /}-separated path. The path is relative to
* the classpath root in which the resource is located.
* Get the name of this resource.
*
* <p>The resource name is a {@code /}-separated path. The path is relative
* to the classpath root in which the resource is located.
*
* @return the resource name; never {@code null}
*/
String getName();

/**
* Get URI to a resource.
* Get the URI of this resource.
*
* @return the uri of the resource; never {@code null}
*/
URI getUri();

/**
* Returns an input stream for reading this resource.
* Get an {@link InputStream} for reading this resource.
*
* <p>The default implementation delegates to {@link java.net.URL#openStream()}
* for this resource's {@link #getUri() URI}.
*
* @return an input stream for this resource; never {@code null}
* @throws IOException if an I/O exception occurs
*/
default InputStream getInputStream() throws IOException {
return getUri().toURL().openStream();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,10 @@ private String determineFullyQualifiedClassName(Path baseDir, String basePackage

/**
* The fully qualified resource name is a {@code /}-separated path.
* <p>
* The path is relative to the classpath root in which the resource is located.
*
* <p>The path is relative to the classpath root in which the resource is
* located.
*
* @return the resource name; never {@code null}
*/
private String determineFullyQualifiedResourceName(Path baseDir, String basePackageName, Path resourceFile) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,17 @@ public static Optional<String> getAttribute(Class<?> type, String name) {
return Optional.ofNullable(mainAttributes.getValue(name));
}
}
catch (Exception e) {
catch (Exception ex) {
return Optional.empty();
}
}

/**
* Get the module or implementation version for the supplied {@code type}.
* <p>
* The former is only available if the type is part of a versioned module on
* the module path; the latter only if the type is part of a JAR file with a
* manifest that contains an {@code Implementation-Version} attribute.
*
* <p>The former is only available if the type is part of a versioned module
* on the module path; the latter only if the type is part of a JAR file with
* a manifest that contains an {@code Implementation-Version} attribute.
*
* @since 1.11
*/
Expand All @@ -117,4 +117,5 @@ public static Optional<String> getModuleOrImplementationVersion(Class<?> type) {
}
return getAttribute(type, Package::getImplementationVersion);
}

}

0 comments on commit 6804dd9

Please sign in to comment.