Search code examples
javaunit-testingassertj

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?


Solution

  • assertThat(yoda.isJedi()).isTrue()