TestSmells / TestSmellDetector

A tool to detect test smells in Java projects that utilize JUnit as the testing framework
https://testsmells.github.io/
GNU General Public License v3.0
73 stars 39 forks source link

[AssertionRoulette] Handle Assertj's methods `Descriptable.as` and `AbstractAssert.withFailMessage` #13

Open victorgveloso opened 3 years ago

victorgveloso commented 3 years ago

As discussed in a stackoverflow question. AssertJ's assertions differ from builtin Junit's assertions as they don't have third or second parameters for descriptions. Instead, they offer the Descriptable.as and AbstractAssert.withFailMessage methods.

On the other hand, TSDetect's AssertionRoulette implementation ( at /src/main/java/testsmell/smell/AssertionRoulette.java) handles an homonymous assertion from Junit 4 (assertThat) which is deprecated. For projects using AssertJ, this could raise the false impression that test methods using Descriptable.as or AbstractAssert.withFailMessage are description-less.