Problem in resolving assertThat method.

3,603 views
Skip to first unread message

Sharath Kumar

unread,
Mar 14, 2016, 3:48:41 AM3/14/16
to Robolectric
Assert.assertThat(menu.findItem(R.id.menu_item1).getTitle()).isEqualTo("Select All");

when i use the above statement in my tests, i get "cannot resolve method assertThat(java.lang.CharSequence)". What might be the error? how can i solve it?
What should i import?

P.S: I have already imported this--> import static org.junit.Assert.*;

Fr Jeremy Krieg

unread,
Mar 15, 2016, 4:49:30 AM3/15/16
to Robolectric
Try static-importing org.assertj.core.api.Assertions.assertThat() if you want to use that syntax. You also need to ensure that your project declares assertj-core as a test dependency. Hope this helps.

Blessings,
Fr Jeremy

Reply all
Reply to author
Forward
0 new messages