wsclient/src/test/kotlin/com/cubetiqs/wsclient/RSocketClientApplicationTes...

24 lines
698 B
Kotlin

package com.cubetiqs.wsclient
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import reactor.core.publisher.Flux
@SpringBootTest
class RSocketClientApplicationTests @Autowired constructor(
private val stockClient: StockClient
) {
@Test
fun shouldRetrieveStockPricesFromTheService() {
val prices: Flux<StockPrice> = stockClient.priceFor("USD")
Assertions.assertNotNull(prices)
val fivePrices = prices.take(5)
Assertions.assertEquals(5, fivePrices.count().block())
Assertions.assertEquals("USD", fivePrices.blockFirst()?.symbol)
}
}