-
-
Save pbochenski/23653b54f885aa4c0ec9baef9def8b3f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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