Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot resolve symbol assertThat

I have the following dependencies in my build.gradle file

 testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'

And my test class EmailValidatorTest has the following code

  @Test
public void emailValidator_simpleEmail_returnsTrue(){

   assertThat(EmailValidator.isValidEmail("[email protected]"),is(true))
}

But i get the error as Cannot resolve symbol assertThat. I get only assert object .I'm currently working on a sample from Android Developers i,e : https://github.com/googlesamples/android-testing/tree/master/unit/BasicSample.

like image 710
Android Avatar asked Aug 09 '17 09:08

Android


1 Answers

Make sure you imported assertThat.

public static <T> void assertThat(T actual,
                                  org.hamcrest.Matcher<T> matcher)

import static org.hamcrest.MatcherAssert.assertThat;

Then Clean-Rebuild-Run .

like image 120
IntelliJ Amiya Avatar answered Sep 30 '22 05:09

IntelliJ Amiya