Grails / groovy testing - any difference between assert and assertEquals methods

I have many Grails classes and groovy integration.

I initially used methods like assertEquals, assertNull, assertTrue, assertFalse, etc.

assertEquals 0, User.list().size()

but lately, I prefer to use a direct statement:

assert User.list().size() == 0

Is there a difference between the two approaches?

+4
source share
2 answers

assertEqualsuses the JUnit statement, while assertuses the groovy power assert. Power assert gives you more enjoyable error messages and is built into the language. You should usually use this whenever you can.

+8
source

An AssertionError , assertEquals , , assert, assert groovy .

+2

All Articles