Assertions with Side Effects
Assertions with Side Effects
Assertion conditions can have side effects. This is risky because the behavior depends on whether assertions are on or off. This is usually not intentional, and can lead to bugs where the production version differs from the version tested during development.
Generally, you'll want to perform the operation with the side effect before the assertion, and then assert that the result was what you expected.
Issue id: AssertionSideEffect
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for Android 2023.3, Qodana for JVM 2023.3 |
Plugin: | Android, 2022.3.1 Beta 2 |
Last modified: 13 July 2023