mardi 22 novembre 2016

Why I get package org.mockito.runners does not exist?

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!

Aucun commentaire:

Enregistrer un commentaire