From e243117e89699244382e95708015d47df262bcfa Mon Sep 17 00:00:00 2001 From: Oleh Kurpiak Date: Sat, 16 Apr 2022 11:29:45 +0300 Subject: [PATCH] [Java] Ignore return value for Java file assert classes (#12145) --- .../codegen/java/assertions/AbstractAnnotationAssert.java | 2 ++ .../openapitools/codegen/java/assertions/JavaFileAssert.java | 2 ++ .../codegen/java/assertions/MethodAnnotationAssert.java | 3 +++ .../org/openapitools/codegen/java/assertions/MethodAssert.java | 3 ++- .../codegen/java/assertions/ParameterAnnotationAssert.java | 3 +++ .../openapitools/codegen/java/assertions/ParameterAssert.java | 2 ++ .../codegen/java/assertions/PropertyAnnotationAssert.java | 3 +++ .../openapitools/codegen/java/assertions/PropertyAssert.java | 3 ++- .../codegen/java/assertions/TypeAnnotationAssert.java | 3 +++ 9 files changed, 22 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/AbstractAnnotationAssert.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/AbstractAnnotationAssert.java index 8f8351103d56..05b53d5fa09e 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/AbstractAnnotationAssert.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/AbstractAnnotationAssert.java @@ -7,6 +7,7 @@ import java.util.stream.Collectors; import org.assertj.core.api.ListAssert; +import org.assertj.core.util.CanIgnoreReturnValue; import com.github.javaparser.ast.expr.AnnotationExpr; import com.github.javaparser.ast.expr.MarkerAnnotationExpr; @@ -15,6 +16,7 @@ import com.github.javaparser.ast.nodeTypes.NodeWithSimpleName; import com.google.common.collect.ImmutableMap; +@CanIgnoreReturnValue public abstract class AbstractAnnotationAssert> extends ListAssert { protected AbstractAnnotationAssert(final List annotationExpr) { diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/JavaFileAssert.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/JavaFileAssert.java index cf48a71930ca..3189c4086637 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/JavaFileAssert.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/JavaFileAssert.java @@ -10,6 +10,7 @@ import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.Assertions; +import org.assertj.core.util.CanIgnoreReturnValue; import com.github.javaparser.StaticJavaParser; import com.github.javaparser.ast.CompilationUnit; @@ -17,6 +18,7 @@ import com.github.javaparser.ast.body.MethodDeclaration; import com.github.javaparser.ast.nodeTypes.NodeWithName; +@CanIgnoreReturnValue public class JavaFileAssert extends AbstractAssert { private JavaFileAssert(final CompilationUnit actual) { diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/MethodAnnotationAssert.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/MethodAnnotationAssert.java index 60fc9d6f8fd0..5667e29a4dcb 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/MethodAnnotationAssert.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/MethodAnnotationAssert.java @@ -2,8 +2,11 @@ import java.util.List; +import org.assertj.core.util.CanIgnoreReturnValue; + import com.github.javaparser.ast.expr.AnnotationExpr; +@CanIgnoreReturnValue public class MethodAnnotationAssert extends AbstractAnnotationAssert { private final MethodAssert methodAssert; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/MethodAssert.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/MethodAssert.java index e9d302328751..37ab7d6028d9 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/MethodAssert.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/MethodAssert.java @@ -6,13 +6,14 @@ import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.Assertions; +import org.assertj.core.util.CanIgnoreReturnValue; -import com.github.javaparser.ast.Node; import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; import com.github.javaparser.ast.body.MethodDeclaration; import com.github.javaparser.ast.body.Parameter; import com.github.javaparser.ast.nodeTypes.NodeWithName; +@CanIgnoreReturnValue public class MethodAssert extends AbstractAssert { private final JavaFileAssert fileAssert; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/ParameterAnnotationAssert.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/ParameterAnnotationAssert.java index 7348d34f04c9..184943bd4dac 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/ParameterAnnotationAssert.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/ParameterAnnotationAssert.java @@ -2,8 +2,11 @@ import java.util.List; +import org.assertj.core.util.CanIgnoreReturnValue; + import com.github.javaparser.ast.expr.AnnotationExpr; +@CanIgnoreReturnValue public class ParameterAnnotationAssert extends AbstractAnnotationAssert { private final ParameterAssert parameterAssert; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/ParameterAssert.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/ParameterAssert.java index 6fe73ce5899d..a6a4a732cc96 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/ParameterAssert.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/ParameterAssert.java @@ -2,9 +2,11 @@ import org.assertj.core.api.Assertions; import org.assertj.core.api.ObjectAssert; +import org.assertj.core.util.CanIgnoreReturnValue; import com.github.javaparser.ast.body.Parameter; +@CanIgnoreReturnValue public class ParameterAssert extends ObjectAssert { private final MethodAssert methodAssert; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/PropertyAnnotationAssert.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/PropertyAnnotationAssert.java index 3db06d49aed5..92636a907300 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/PropertyAnnotationAssert.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/PropertyAnnotationAssert.java @@ -2,8 +2,11 @@ import java.util.List; +import org.assertj.core.util.CanIgnoreReturnValue; + import com.github.javaparser.ast.expr.AnnotationExpr; +@CanIgnoreReturnValue public class PropertyAnnotationAssert extends AbstractAnnotationAssert { private final PropertyAssert propertyAssert; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/PropertyAssert.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/PropertyAssert.java index 476b530f4b2a..9cf733a05a82 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/PropertyAssert.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/PropertyAssert.java @@ -2,10 +2,11 @@ import org.assertj.core.api.Assertions; import org.assertj.core.api.ObjectAssert; +import org.assertj.core.util.CanIgnoreReturnValue; import com.github.javaparser.ast.body.FieldDeclaration; -import com.github.javaparser.ast.body.Parameter; +@CanIgnoreReturnValue public class PropertyAssert extends ObjectAssert { private final JavaFileAssert javaFileAssert; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/TypeAnnotationAssert.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/TypeAnnotationAssert.java index 286474fa29ef..f8418510049e 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/TypeAnnotationAssert.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/TypeAnnotationAssert.java @@ -2,8 +2,11 @@ import java.util.List; +import org.assertj.core.util.CanIgnoreReturnValue; + import com.github.javaparser.ast.expr.AnnotationExpr; +@CanIgnoreReturnValue public class TypeAnnotationAssert extends AbstractAnnotationAssert { private final JavaFileAssert fileAssert;