And*_*oid 5 android android-testing
我的build.gradle文件中有以下依赖项
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
Run Code Online (Sandbox Code Playgroud)
我的测试类EmailValidatorTest有以下代码
@Test
public void emailValidator_simpleEmail_returnsTrue(){
assertThat(EmailValidator.isValidEmail("name@ex.com"),is(true))
}
Run Code Online (Sandbox Code Playgroud)
但我得到的错误是Cannot resolve symbol assertThat. 我只得到assert对象。我目前正在处理来自Android Developersi,e的样本:https://github.com/googlesamples/android-testing/tree/master/unit/BasicSample。
确保您导入了assertThat。
public static <T> void assertThat(T actual,
org.hamcrest.Matcher<T> matcher)
Run Code Online (Sandbox Code Playgroud)
导入静态 org.hamcrest.MatcherAssert.assertThat;
然后Clean-Rebuild-Run。
| 归档时间: |
|
| 查看次数: |
10047 次 |
| 最近记录: |