Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion documentation/src/test/java/example/AssertionsDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import example.domain.Person;
import example.util.Calculator;

import extensions.DisabledOnOpenJ9;

import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -87,7 +89,7 @@ void dependentAssertions() {
}

// end::user_guide[]
@extensions.DisabledOnOpenJ9
@DisabledOnOpenJ9
// tag::user_guide[]
@Test
void exceptionTesting() {
Expand Down
7 changes: 5 additions & 2 deletions documentation/src/test/java/example/RepeatedTestsDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@
import java.util.logging.Logger;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.RepeatedTest;
import org.junit.jupiter.api.RepetitionInfo;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode;

// end::user_guide[]
// Use fully qualified names to avoid having them show up in the imports.
@org.junit.jupiter.api.parallel.Execution(org.junit.jupiter.api.parallel.ExecutionMode.SAME_THREAD)
@Execution(ExecutionMode.SAME_THREAD)
// tag::user_guide[]
class RepeatedTestsDemo {

Expand Down Expand Up @@ -54,7 +57,7 @@ void repeatedTestWithRepetitionInfo(RepetitionInfo repetitionInfo) {

// end::user_guide[]
// Use fully qualified name to avoid having it show up in the imports.
@org.junit.jupiter.api.Disabled("intentional failures would break the build")
@Disabled("intentional failures would break the build")
// tag::user_guide[]
@RepeatedTest(value = 8, failureThreshold = 2)
void repeatedTestWithFailureThreshold(RepetitionInfo repetitionInfo) {
Expand Down
4 changes: 3 additions & 1 deletion documentation/src/test/java/example/StandardTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

import extensions.ExpectToFail;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
Expand All @@ -36,7 +38,7 @@ void succeedingTest() {
}

// end::user_guide[]
@extensions.ExpectToFail
@ExpectToFail
// tag::user_guide[]
@Test
void failingTest() {
Expand Down
3 changes: 2 additions & 1 deletion documentation/src/test/java/example/SuiteDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
package example;

//tag::user_guide[]
import org.junit.platform.suite.api.ExcludeTags;
import org.junit.platform.suite.api.IncludeClassNamePatterns;
import org.junit.platform.suite.api.SelectPackages;
import org.junit.platform.suite.api.Suite;
Expand All @@ -21,7 +22,7 @@
@SelectPackages("example")
@IncludeClassNamePatterns(".*Tests")
//end::user_guide[]
@org.junit.platform.suite.api.ExcludeTags("exclude")
@ExcludeTags("exclude")
//tag::user_guide[]
class SuiteDemo {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import static org.junit.platform.engine.discovery.DiscoverySelectors.selectPackage;
import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.discoveryRequest;

import org.junit.jupiter.api.Test;
import org.junit.platform.launcher.LauncherDiscoveryRequest;
import org.junit.platform.launcher.LauncherSession;
import org.junit.platform.launcher.TestPlan;
Expand All @@ -27,7 +28,7 @@
*/
class UsingTheLauncherForDiscoveryDemo {

@org.junit.jupiter.api.Test
@Test
@SuppressWarnings("unused")
void discovery() {
// @formatter:off
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import junitbuild.extensions.dependencyFromLibs
import net.ltgt.gradle.errorprone.errorprone
import net.ltgt.gradle.nullaway.nullaway
import org.gradle.jvm.toolchain.JvmImplementation.J9

plugins {
`java-library`
Expand All @@ -16,17 +17,10 @@ dependencies {

tasks.withType<JavaCompile>().configureEach {
options.errorprone {
val shouldDisableErrorProne = java.toolchain.implementation.orNull == JvmImplementation.J9
if (name == "compileJava" && !shouldDisableErrorProne) {
disable(
"AnnotateFormatMethod", // We don`t want to use ErrorProne's annotations.
"BadImport", // This check is opinionated wrt. which method names it considers unsuitable for import which includes a few of our own methods in `ReflectionUtils` etc.
"DoNotCallSuggester", // We don`t want to use ErrorProne's annotations.
"ImmutableEnumChecker", // We don`t want to use ErrorProne's annotations.
"InlineMeSuggester", // We don`t want to use ErrorProne's annotations.
"MissingSummary", // Produces a lot of findings that we consider to be false positives, for example for package-private classes and methods.
"StringSplitter", // We don`t want to use Guava.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont need to disable warnings they are already treaded like this for a reason by convention.

"UnnecessaryLambda", // The findings of this check are subjective because a named constant can be more readable in many cases.
val enableErrorProne = java.toolchain.implementation.orNull != J9
if (name == "compileJava" && enableErrorProne) {
disableAllWarnings = true // considering this immense spam burden, remove this once to fix dedicated flaw. https://github.com/diffplug/spotless/pull/2766
disable( // We don`t want to use ErrorProne's annotations.
// picnic (https://error-prone.picnic.tech)
"ConstantNaming",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

therefore this still seems an bug, as need to disable picnic warnings, as they fail the build if not treated the extra way?

isn´t it? @rickie

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Pankraz76,

Thanks for flagging the issues with the Picnic warnings in these various tickets, such as google/error-prone#5365.

I want to emphasize that I appreciate you taking the time to apply our checks. It is great to see them being applied in the wild.

That said, to make these reports actionable, we really need a minimal reproduction case when things break. As noted by @cushon here google/error-prone#5365 (comment) and here google/error-prone#5277 (comment), simply knowing that it fails in a repository makes it very hard for us to debug.

If we can isolate the specific code causing the crash, we can fix the root cause instead of just disabling the check. To be clear, I do believe you could be right and that there is a bug in our code or in Error Prone itself. If so, we definitely want to fix it, but we need those isolated examples to make that happen.

"DirectReturn", // We don`t want to use this: https://github.com/junit-team/junit-framework/pull/5006#discussion_r2403984446
Expand All @@ -45,18 +39,23 @@ tasks.withType<JavaCompile>().configureEach {
error(
"CanonicalAnnotationSyntax",
"IsInstanceLambdaUsage",
"MissingOverride",
"PackageLocation",
"RedundantStringConversion",
"RedundantStringEscape",
"SelfAssignment",
"StringCharset",
"StringJoin",
"UnnecessarilyFullyQualified",
)
} else {
disableAllChecks = true
}
nullaway {
if (shouldDisableErrorProne) {
disable()
} else {
if (enableErrorProne) {
enable()
} else {
disable()
}
onlyNullMarked = true
isJSpecifyMode = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public interface ClassOrderer {
* <h4>Supported Values</h4>
*
* <p>Supported values include fully qualified class names for types that
* implement {@link org.junit.jupiter.api.ClassOrderer}.
* implement {@link ClassOrderer}.
*
* <p>If not specified, test classes are not ordered unless test classes are
* annotated with {@link TestClassOrder @TestClassOrder}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public interface MethodOrderer {
* <h4>Supported Values</h4>
*
* <p>Supported values include fully qualified class names for types that
* implement {@link org.junit.jupiter.api.MethodOrderer}.
* implement {@link MethodOrderer}.
*
* <p>If not specified, test methods will be ordered using an algorithm that
* is deterministic but intentionally non-obvious.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public interface Named<T extends @Nullable Object> {
* depending on the use case
* @param <T> the type of the payload
* @return an instance of {@code Named}; never {@code null}
* @see #named(String, java.lang.Object)
* @see #named(String, Object)
*/
static <T extends @Nullable Object> Named<T> of(String name, T payload) {
Preconditions.notBlank(name, "name must not be null or blank");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ enum Lifecycle {
* <h4>Supported Values</h4>
*
* <p>Supported values include names of enum constants defined in
* {@link org.junit.jupiter.api.TestInstance.Lifecycle}, ignoring case.
* {@link TestInstance.Lifecycle}, ignoring case.
*
* <p>If not specified, the default is "per_method" which corresponds to
* {@code @TestInstance(Lifecycle.PER_METHOD)}.
*
* @since 5.0
* @see org.junit.jupiter.api.TestInstance
* @see TestInstance
*/
@API(status = STABLE, since = "5.9")
public static final String DEFAULT_LIFECYCLE_PROPERTY_NAME = "junit.jupiter.testinstance.lifecycle.default";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@
*
* @since 5.6
* @see JRE
* @see org.junit.jupiter.api.condition.EnabledIf
* @see org.junit.jupiter.api.condition.DisabledIf
* @see org.junit.jupiter.api.condition.EnabledOnOs
* @see org.junit.jupiter.api.condition.DisabledOnOs
* @see org.junit.jupiter.api.condition.EnabledOnJre
* @see org.junit.jupiter.api.condition.DisabledOnJre
* @see org.junit.jupiter.api.condition.EnabledForJreRange
* @see org.junit.jupiter.api.condition.EnabledInNativeImage
* @see org.junit.jupiter.api.condition.DisabledInNativeImage
* @see org.junit.jupiter.api.condition.EnabledIfSystemProperty
* @see org.junit.jupiter.api.condition.DisabledIfSystemProperty
* @see org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable
* @see org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable
* @see EnabledIf
* @see DisabledIf
* @see EnabledOnOs
* @see DisabledOnOs
* @see EnabledOnJre
* @see DisabledOnJre
* @see EnabledForJreRange
* @see EnabledInNativeImage
* @see DisabledInNativeImage
* @see EnabledIfSystemProperty
* @see DisabledIfSystemProperty
* @see EnabledIfEnvironmentVariable
* @see DisabledIfEnvironmentVariable
* @see org.junit.jupiter.api.Disabled
*/
@Target({ ElementType.TYPE, ElementType.METHOD })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,19 @@
* {@code @Disabled*} annotations in this package.
*
* @since 5.7
* @see org.junit.jupiter.api.condition.EnabledIf
* @see org.junit.jupiter.api.condition.EnabledOnOs
* @see org.junit.jupiter.api.condition.DisabledOnOs
* @see org.junit.jupiter.api.condition.EnabledOnJre
* @see org.junit.jupiter.api.condition.DisabledOnJre
* @see org.junit.jupiter.api.condition.EnabledForJreRange
* @see org.junit.jupiter.api.condition.DisabledForJreRange
* @see org.junit.jupiter.api.condition.EnabledInNativeImage
* @see org.junit.jupiter.api.condition.DisabledInNativeImage
* @see org.junit.jupiter.api.condition.EnabledIfSystemProperty
* @see org.junit.jupiter.api.condition.DisabledIfSystemProperty
* @see org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable
* @see org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable
* @see EnabledIf
* @see EnabledOnOs
* @see DisabledOnOs
* @see EnabledOnJre
* @see DisabledOnJre
* @see EnabledForJreRange
* @see DisabledForJreRange
* @see EnabledInNativeImage
* @see DisabledInNativeImage
* @see EnabledIfSystemProperty
* @see DisabledIfSystemProperty
* @see EnabledIfEnvironmentVariable
* @see DisabledIfEnvironmentVariable
* @see org.junit.jupiter.api.Disabled
*/
@Target({ ElementType.TYPE, ElementType.METHOD })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@
* indirectly present, or meta-present on a given element.
*
* @since 5.1
* @see org.junit.jupiter.api.condition.EnabledIf
* @see org.junit.jupiter.api.condition.DisabledIf
* @see org.junit.jupiter.api.condition.EnabledOnOs
* @see org.junit.jupiter.api.condition.DisabledOnOs
* @see org.junit.jupiter.api.condition.EnabledOnJre
* @see org.junit.jupiter.api.condition.DisabledOnJre
* @see org.junit.jupiter.api.condition.EnabledForJreRange
* @see org.junit.jupiter.api.condition.DisabledForJreRange
* @see org.junit.jupiter.api.condition.EnabledInNativeImage
* @see org.junit.jupiter.api.condition.DisabledInNativeImage
* @see org.junit.jupiter.api.condition.EnabledIfSystemProperty
* @see org.junit.jupiter.api.condition.DisabledIfSystemProperty
* @see org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable
* @see EnabledIf
* @see DisabledIf
* @see EnabledOnOs
* @see DisabledOnOs
* @see EnabledOnJre
* @see DisabledOnJre
* @see EnabledForJreRange
* @see DisabledForJreRange
* @see EnabledInNativeImage
* @see DisabledInNativeImage
* @see EnabledIfSystemProperty
* @see DisabledIfSystemProperty
* @see EnabledIfEnvironmentVariable
* @see org.junit.jupiter.api.Disabled
*/
@Target({ ElementType.TYPE, ElementType.METHOD })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@
* indirectly present, or meta-present on a given element.
*
* @since 5.1
* @see org.junit.jupiter.api.condition.EnabledIf
* @see org.junit.jupiter.api.condition.DisabledIf
* @see org.junit.jupiter.api.condition.EnabledOnOs
* @see org.junit.jupiter.api.condition.DisabledOnOs
* @see org.junit.jupiter.api.condition.EnabledOnJre
* @see org.junit.jupiter.api.condition.DisabledOnJre
* @see org.junit.jupiter.api.condition.EnabledForJreRange
* @see org.junit.jupiter.api.condition.DisabledForJreRange
* @see org.junit.jupiter.api.condition.EnabledInNativeImage
* @see org.junit.jupiter.api.condition.DisabledInNativeImage
* @see org.junit.jupiter.api.condition.EnabledIfSystemProperty
* @see org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable
* @see org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable
* @see EnabledIf
* @see DisabledIf
* @see EnabledOnOs
* @see DisabledOnOs
* @see EnabledOnJre
* @see DisabledOnJre
* @see EnabledForJreRange
* @see DisabledForJreRange
* @see EnabledInNativeImage
* @see DisabledInNativeImage
* @see EnabledIfSystemProperty
* @see EnabledIfEnvironmentVariable
* @see DisabledIfEnvironmentVariable
* @see org.junit.jupiter.api.Disabled
*/
@Target({ ElementType.TYPE, ElementType.METHOD })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@
* <a href="https://www.graalvm.org/reference-manual/native-image/metadata/AutomaticMetadataCollection/">tracing agent</a>.
*
* @since 5.9.1
* @see org.junit.jupiter.api.condition.EnabledIf
* @see org.junit.jupiter.api.condition.DisabledIf
* @see org.junit.jupiter.api.condition.EnabledOnOs
* @see org.junit.jupiter.api.condition.DisabledOnOs
* @see org.junit.jupiter.api.condition.EnabledOnJre
* @see org.junit.jupiter.api.condition.DisabledOnJre
* @see org.junit.jupiter.api.condition.EnabledForJreRange
* @see org.junit.jupiter.api.condition.DisabledForJreRange
* @see org.junit.jupiter.api.condition.EnabledInNativeImage
* @see org.junit.jupiter.api.condition.EnabledIfSystemProperty
* @see org.junit.jupiter.api.condition.DisabledIfSystemProperty
* @see org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable
* @see org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable
* @see EnabledIf
* @see DisabledIf
* @see EnabledOnOs
* @see DisabledOnOs
* @see EnabledOnJre
* @see DisabledOnJre
* @see EnabledForJreRange
* @see DisabledForJreRange
* @see EnabledInNativeImage
* @see EnabledIfSystemProperty
* @see DisabledIfSystemProperty
* @see EnabledIfEnvironmentVariable
* @see DisabledIfEnvironmentVariable
* @see org.junit.jupiter.api.Disabled
*/
@Target({ ElementType.TYPE, ElementType.METHOD })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,19 @@
*
* @since 5.1
* @see JRE
* @see org.junit.jupiter.api.condition.EnabledIf
* @see org.junit.jupiter.api.condition.DisabledIf
* @see org.junit.jupiter.api.condition.EnabledOnOs
* @see org.junit.jupiter.api.condition.DisabledOnOs
* @see org.junit.jupiter.api.condition.EnabledOnJre
* @see org.junit.jupiter.api.condition.EnabledForJreRange
* @see org.junit.jupiter.api.condition.DisabledForJreRange
* @see org.junit.jupiter.api.condition.EnabledInNativeImage
* @see org.junit.jupiter.api.condition.DisabledInNativeImage
* @see org.junit.jupiter.api.condition.EnabledIfSystemProperty
* @see org.junit.jupiter.api.condition.DisabledIfSystemProperty
* @see org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable
* @see org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable
* @see EnabledIf
* @see DisabledIf
* @see EnabledOnOs
* @see DisabledOnOs
* @see EnabledOnJre
* @see EnabledForJreRange
* @see DisabledForJreRange
* @see EnabledInNativeImage
* @see DisabledInNativeImage
* @see EnabledIfSystemProperty
* @see DisabledIfSystemProperty
* @see EnabledIfEnvironmentVariable
* @see DisabledIfEnvironmentVariable
* @see org.junit.jupiter.api.Disabled
*/
@Target({ ElementType.TYPE, ElementType.METHOD })
Expand Down
Loading
Loading