I created this Groovy translation for a codewars kata. There, a user suggested some things to improve the translation, the first one being:
assertEquals
should be used instead ofassert
for both the test cases and the sample test cases. I assume that org.junit.jupiter.api.Assertions.assertEquals
is meant here.
My question is: Why should I use assertEquals
instead of Groovy’s assert
statement? So far, Codewars is the only place where I have any experience with testing, but Groovy’s assert
seems fine to me.
(Btw. I am asking this here instead of the codewars discussions because I haven’t gotten an answer there yet)
Also, this isn’t a duplicate of Grails/groovy testing – any difference between assert and assertEquals methods since the fist answer gives a reason why to use Groovy’s assert
instead of assertEquals
, and the second one is just about the differences.
5