I have pluged up require dependency
testCompile 'org.mockito:mockito-core:1.10.19'
Then I put my test code to /src/test/java/
directory
then I have tried launch such test
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
public class PresenterActivityAcceptNotAcceptTest {
@Test
public void emailValidator_CorrectEmailSimple_ReturnsTrue() {
boolean dd = true;
assertThat(dd, is(true));
}
it works properly, but if I add anything witch associated with Mock
lib
for example @RunWith
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
@RunWith(MockitoJUnitRunner.class)
public class PresenterActivityAcceptNotAcceptTest {
@Test
public void emailValidator_CorrectEmailSimple_ReturnsTrue() {
boolean dd = true;
assertThat(dd, is(true));
}
I got such error
Error:Execution failed for task ':Application:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Error:(10, 10) error: cannot find symbol class MockitoJUnitRunner
Error:(5, 27) error: package org.mockito.runners does not exist
/home/aleksey/Downloads/NTZ/FittingRoom/Application/src/test/java/com/fittingroom/newtimezone/presenters/PresenterActivityAcceptNotAcceptTest.java
What am I doing wrong?
If I forger about something feel free to ask
Thanks in advance!
It looks like Gradle is not doing it's job. Manually adding the jars may fixed the problem. How to Download and Install jar go here .
and for download mockito use this link
https://mvnrepository.com/artifact/org.mockito/mockito-core/1.10.19
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With