Happy
01/20/2019, 7:28 PMchansek
01/26/2020, 3:28 PMchansek
01/26/2020, 3:28 PMChills
01/26/2020, 3:46 PMChills
01/26/2020, 6:48 PMKashif
01/26/2020, 6:57 PMpaulex
01/27/2020, 12:39 AMoverride fun createWallet(request: CreateWalletRequest?, responseObserver: StreamObserver<Wallet>) {
GlobalScope.launch {
val wallet = async { return@async this@WalletService.repo.get(1) }
responseObserver.onNext(wallet.await())
responseObserver.onCompleted()
}
}
The code within the GlobalScope.launch runs well, i can print it out...
the onNext(value) is called and i can't seem to get the value from my test...
What i've tried but doesn't work...
@ExperimentalCoroutinesApi
@Test
fun `createWallet should pass`() = runBlockingTest {
//Arrange
val responseObserver = mockk<StreamObserver<Wallet>>()
val slot = slot<Wallet>()
every { responseObserver.onNext(capture(slot)) } just Runs
every { responseObserver.onCompleted() } just Runs
val wallet = Wallet.newBuilder().setUserId(2).build()
coEvery { repo.get(1) } returns wallet
val request = CreateWalletRequest.newBuilder()
.setWallet(wallet)
.build()
//Act
this@WalletServiceTest.walletService.createWallet(request, responseObserver)
//Assert
assertThat(slot.captured).isNotNull()
}
thanksforallthefish
01/27/2020, 8:44 AMclass Test{}
class Another {
fun <E> test2(test: E) = test.test()
fun <E> E.test() = if(this is Any)
println(this.javaClass.simpleName) else {}
}
Another().test2(
Test()
)
prints Test
class Test{}
class Another {
fun <E> test2(test: E) = test.test()
fun <E> E.test() = if(this is Any)
println(javaClass.simpleName) else {}
}
Another().test2(
Test()
)
prints Another
thanksforallthefish
01/27/2020, 8:46 AMChills
01/27/2020, 10:34 PMuser
01/28/2020, 10:30 AMmarcinmoskala
01/29/2020, 9:57 AMuser
01/29/2020, 4:25 PMuser
01/29/2020, 4:43 PMivano
01/30/2020, 8:16 AMfun makeCashPeriod(): CashPeriod {
return CashPeriod(period = randomString(), status = randomString(), type = randomString(), numberOfEntries = randomInt(), isCashCountRequired = randomBoolean(), mutationBalance = randomString(), canBeClosed = randomBoolean(), remark = randomString())
}
Sylvain Patenaude
01/30/2020, 2:23 PMuser
01/30/2020, 4:30 PMPisco
01/30/2020, 7:45 PMAlessandro Tagliapietra
01/31/2020, 1:49 AMAlessandro Tagliapietra
01/31/2020, 1:54 AMorder?.getParameters()
it works fine but intellij complains Unnecessary safe call on a non-null receiver of type Order
Alessandro Tagliapietra
01/31/2020, 1:55 AMAlessandro Tagliapietra
01/31/2020, 1:55 AMBrian Dilley
01/31/2020, 6:51 PMsnowe
02/02/2020, 7:02 AMJoeywp
02/02/2020, 3:29 PMChills
02/02/2020, 3:44 PMChills
02/02/2020, 4:02 PMcamdenorrb
02/03/2020, 7:20 AMpablofloresarg
02/03/2020, 4:03 PMuser
02/04/2020, 10:30 AM