Skip to content

Instantly share code, notes, and snippets.

@pbochenski
Last active April 19, 2017 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbochenski/23653b54f885aa4c0ec9baef9def8b3f to your computer and use it in GitHub Desktop.
Save pbochenski/23653b54f885aa4c0ec9baef9def8b3f to your computer and use it in GitHub Desktop.
package pl.pbochenski
import junit.framework.TestCase
import org.junit.Test
import org.mockito.Mockito.`when`
import org.mockito.Mockito.mock
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.addSingleton
import uy.kohesive.injekt.api.get
/**
* Created by Pawel Bochenski on 19.04.2017.
*/
class InjektIssueTest {
interface ToTest {
fun getData(): Int
}
@Test
fun injektIssue() {
val mockito = mock(ToTest::class.java)
val mockito2 = mock(ToTest::class.java)
`when`(mockito2.getData()).thenReturn(4)
Injekt.addSingleton(mockito)
Injekt.addSingleton(mockito2)
val test: ToTest = Injekt.get()
TestCase.assertEquals(4, test.getData()) //fail: 4 !== 0
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment