Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check boolean getter with AssertJ?

It looks very cool

assertThat(yoda).is(jedi);

until you don't know what is yoda and jedi. But suppose

yoda instanceof Person

where

interface Person {
    boolean isJedi();
}

Then how actually check isJedi with AssertJ?

In conventional JUnit I would write

assertTrue( yoda.isJedi() );

but what in AssertJ?

like image 768
Dims Avatar asked Aug 30 '16 13:08

Dims


1 Answers

assertThat(yoda.isJedi()).isTrue()
like image 92
JB Nizet Avatar answered Oct 23 '22 10:10

JB Nizet