in build.gradle
dependencies {
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
}
Code
import com.myapp.LVActivity;
import org.junit.Test;
import static org.junit.Assert.*;
public class DeviceUnitTest {
@Test
public void check_that_is_correct_device_name_isTrue() {
assertThat(LVActivity.isCorrectDevice("MySpecialDevice"), is(true));
}
}
In LVActivity:
private final static String correctName = "MySpecialDevice";
public static boolean isCorrectDevice(String deviceName) {
return deviceName.equals(correctName);
}
The error is here:
is(true)
Error:
Cannot resolve method is(boolean)
I am trying to do a simple local unit test.
I'm following this tutorial http://ift.tt/1d454hx
Aucun commentaire:
Enregistrer un commentaire