In Kotlin project, Tests written in Java not running


#1

In the ‘test’ folder, I have two tests, one is written in kotlin with robolectric and other one is written in Java using mockito. While running test from the directory, only kotlin tests is running and ignore the test written in java.


#2

More details please. Are using maven/gradle/IntelliJ to run these tests?


#3

Its an android project which uses Gradle.
In the below screenshot, SplashScreenTest is written in kotlin and SplashPresenterTest is written in Java.

Content of SplashPresenterTest.java is
@RunWith(MockitoJUnitRunner.class)
class SplashPresenterTest {

@Mock
SplashMvpView mSplashMvpView;
@Mock
DataManager mDataManager;

SplashMvpPresenter<SplashMvpView> mSplashMvpPresenter;
@Before
public void setUp() throws Exception{
    MockitoAnnotations.initMocks(this);
    mDataManager=mock(DataManager.class);
    mSplashMvpPresenter=new SplashPresenter<>(mDataManager);
}
@Test
void onAttach() {
    when(mDataManager.isLoggedIn()).thenReturn(false);
    mSplashMvpPresenter.onAttach(mSplashMvpView);
    verify(mSplashMvpView).openLoginActivity();
}

}