dave08
12/26/2018, 2:53 PMdownload
function seems to return, but before, it should return progress through the SendChannel
(coroutines) passed to it... will that code do this?Hadi Tok
12/26/2018, 3:47 PMdave08
01/03/2019, 12:46 PMtKw
01/07/2019, 2:30 PManswers
over returns
?Willis
01/07/2019, 11:20 PMUnresolved reference: mockK
error when I execute the testtKw
01/08/2019, 1:28 AMfun getAllActiveWidgetsByPrice(db: DatabaseConnection): List<Widgets> = db.query {
Widgets.select {
Widgets.active eq true
}.orderBy(Widget.price).map { toWidget(it) }
}
Could we verify that Widgets.select
is called?
Could we verify that we pass a lambda with Widgets.active eq true
to Widgets.select
?
I feel like there is a way to do this, but I have not been able to get it to work.Hadi Tok
01/08/2019, 7:52 AMChris Margonis
01/08/2019, 3:23 PMPowerMockito.whenNew(RandomClass.class).withAnyArguments().thenReturn(myMock)
Hadi Tok
01/11/2019, 7:32 AMio.mockk.MockKException: Missing calls inside every { ... } block.
while trying to mock staticString. is it a known problem?Slackbot
01/14/2019, 7:14 PMAnthony f
01/17/2019, 3:22 PMoleksiyp
01/18/2019, 2:18 PMLeoColman
01/19/2019, 4:47 PMExpectSpec
is being used here. Please let us know if you believe that this is #kotlintest's fault 🙂dave08
01/21/2019, 3:40 PMAnthony f
01/21/2019, 5:07 PMSaiedmomen
01/25/2019, 5:35 PMJob
But I get this runtime exception
java.lang.IllegalArgumentException: proxied interface methods have incompatible >return types:
public abstract boolean kotlinx.coroutines.Job.cancel()
public abstract void kotlinx.coroutines.Job.cancel()
at java.lang.reflect.Proxy.validateReturnTypes(Proxy.java:328)
Anthony f
01/30/2019, 10:42 AMgroostav
01/31/2019, 11:01 PMfun usage(){
val result2 = buildMock<java.lang.ProcessBuilder>{
ProcessBuilder::inheritIO {
TODO()
}
//one problem with method refs is that they are ambiguous when the method is overloaded
// but inference takes care of that reasonably elegently
oneArg(ProcessBuilder::directory).invokes {
TODO()
}
}
I also think that using kotlin property references could make mocking of properties much nicersvenjacobs
02/07/2019, 11:22 AMverify {
mock.myFunction(any()) wasNot called
}
Doesn't seem to be correct as this is always true, regardless of whether the function was called or not.svenjacobs
02/08/2019, 12:01 PMcoEvery { view.showDeleteSectionDialog() } returns true
produces
Bad recording sequence. State: AnsweringState
but
with(view) {
coEvery { showDeleteSectionDialog() } returns true
}
does not?Joram Visser
02/16/2019, 7:09 PMHadi Tok
02/18/2019, 4:07 PMSergio Crespo Toubes
02/22/2019, 9:32 AMverify(exactly = 1) { mView.showLocations(any()) }
// Reset verify
locationListPresenter.onFilterTextChanged(text)
verify(exactly = 1) { mView.showLocations(any()) }
i am with this isolationMode IsolationMode.InstancePerLeaf
Davide Giuseppe Farella
02/28/2019, 7:26 AMmockk / verify
a lambda?
Looks like
val observer = mockk<(Int) -> Unit>()
observer( 1)
verify { observer( 1 ) }
Is not working.
Tbh I didn't test exactly that code, I was trying within an Android LiveData, but replacing the mockk with a real lambda i can see right output printed in the console. Same with spy
Anthony f
03/07/2019, 5:28 PMHexa
03/16/2019, 8:40 PMGlobalScope.async { "testCarId" }
part seems weird to me I tried returns "testCarId"
but I'm getting an incompatible type errorHexa
03/17/2019, 10:39 AMdarych
03/19/2019, 1:10 PMio.mockk.MockKException: Failed matching mocking signature for\n\nleft matchers: [any(), any(), any()]
Version 1.8.9
Code:
every { clientFactory.invoke(any(), any(), any()) } returns client
clientFactory
is factory function which returns the object of client.Hexa
03/29/2019, 11:55 PMany()
as argument in the every
part of my tests and then in the verify
part I checked the exactly value of the argument like this every { car.drive(any()) } returns Outcome.OK
verify(exactly = 1) {
car.drive(Direction.SOUTH)
}
. I did this because it saves me a lot of typing (and maybe it makes the code more readable as it's shorter) when the argument I'm passing is too long for example: https://gist.github.com/rinnegan/bd8928a750fab4eaebf89652972c7647#file-using-any-L16. So it is okay to write my tests like this? Or do I need to avoid using any()
and be very explicit and specify the exact argument?Nav Singh
04/03/2019, 3:19 PMNav Singh
04/03/2019, 3:19 PMLeoColman
04/03/2019, 3:32 PMNav Singh
04/03/2019, 5:11 PMLeoColman
04/03/2019, 5:16 PMNav Singh
04/03/2019, 6:35 PM