Skip to content

Instantly share code, notes, and snippets.

@pandelisgreen13
Last active February 8, 2023 13:21
Show Gist options
  • Save pandelisgreen13/5850882b018db04c992cfe3045722983 to your computer and use it in GitHub Desktop.
Save pandelisgreen13/5850882b018db04c992cfe3045722983 to your computer and use it in GitHub Desktop.
Android Studio unit test bug
When we run the following test from the Android Studio, the test is successful, but if you run the unit test from the terminal,
the test is failing as excpected
Steps to reproduce :
1) Create the following class
2) Use the problematic unit test
3) Run the test from android studio and terminal
4) It must behave differently
class TestMapper {
fun testFun(string: String?): String {
return "any"
}
}
import org.junit.Assert
import org.junit.Test
import org.mockito.kotlin.any
class TestMapperTest {
@Test
fun testAny() {
val testMapper = TestMapper()
val result = testMapper.testFun(any())
Assert.assertEquals("any", result)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment