我已經pluged了需要依賴爲什麼我會收到一個錯誤「package org.mockito.runners does not exist」?
testCompile 'org.mockito:mockito-core:1.10.19'
然後,我把我的測試代碼/src/test/java/
目錄
然後我試圖推出這樣的測試
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));
}
它工作正常,但如果我添加與Mock
相關的任何東西lib
例如@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));
}
我得到了這樣的錯誤
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
我在做什麼錯?
如果我僞造的東西隨意問
在此先感謝!
檢查要求的依賴,其範圍 –
是你的測試comlipable?你是否已經試圖清理該項目? –
@PSM你是什麼意思?正如我提到的問題,我已經添加了這種依賴... –