hastebrot
11/16/2015, 9:17 AMyield
keyword (push) in Python and C# and get an iterator (pull).hastebrot
11/16/2015, 9:19 AMsequence { callback -> foo(callback) }.take(10)
dmcg
11/16/2015, 9:29 AMhastebrot
11/16/2015, 9:30 AMhastebrot
11/16/2015, 9:43 AMdnovikov
11/16/2015, 10:27 AM`when`(myObject.myProperty).thenReturn(myValue)
`when`(MyClass::myProperty.get(myObject)).thenReturn(myValue)
helps me.cy
11/16/2015, 11:21 AMclass MyTest {
@Test
fun ttt() {
val o = Mockito.mock(C::class.java)
Mockito.`when`(o.p).thenReturn(99)
assertEquals(99, o.p)
}
}
interface C {
val p: Int
}
mikehearn
11/16/2015, 11:40 AMyole
11/16/2015, 11:42 AMmikehearn
11/16/2015, 11:48 AMmikehearn
11/16/2015, 11:48 AMyole
11/16/2015, 11:51 AMmzgreen
11/16/2015, 11:53 AMdnovikov
11/16/2015, 11:54 AMclass MyTest {
@Test
fun ttt() {
val o = PowerMockito.mock(C::class.java)
Mockito.`when`(o.p).thenReturn(99)
assertEquals(99, o.p)
}
}
class C {
val p: Int = 0
}
yole
11/16/2015, 11:54 AMmzgreen
11/16/2015, 11:54 AMantonioleiva
11/16/2015, 11:54 AMmzgreen
11/16/2015, 11:55 AMyole
11/16/2015, 11:55 AMmzgreen
11/16/2015, 11:55 AMyole
11/16/2015, 11:55 AMcy
11/16/2015, 11:55 AMp
is final so no mocking too could generate implementation unless p is either open or abstractmzgreen
11/16/2015, 11:56 AMmikehearn
11/16/2015, 12:01 PMmikehearn
11/16/2015, 12:01 PMmikehearn
11/16/2015, 12:11 PMmikehearn
11/16/2015, 12:11 PMfun List<AuthenticatedObject<Command>>.requireSingleCommand(klass: Class<out Command>) = filter { klass.isInstance(it) }.single()
mikehearn
11/16/2015, 12:12 PMdnovikov
11/16/2015, 12:12 PMantonioleiva
11/16/2015, 12:15 PM