rspec/rules/S5960/java/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

36 lines
957 B
Plaintext

== Why is this an issue?
Assertions are intended to be used in *test* code, but not in *production* code. It is confusing, and might lead to ``++ClassNotFoundException++`` when the build tools only provide the required dependency in test scope.
In addition, assertions will throw a sub-class of ``++Error++``: ``++AssertionError++``, which should be avoided in production code.
This rule raises an issue when any assertion intended to be used in test is used in production code.
Supported frameworks:
* JUnit
* FestAssert
* AssertJ
Note: this does not apply for ``++assert++`` from Java itself or if the source code package name is related to tests (contains: ``++test++`` or ``++assert++`` or ``++junit++``).
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Remove this assertion from production code.
=== Highlighting
Assertion method name.
endif::env-github,rspecator-view[]