From ba7c679ecd839b98e3772a22c0cbff0ab7bd25e2 Mon Sep 17 00:00:00 2001 From: oshai Date: Thu, 19 Jan 2023 21:57:03 +0200 Subject: [PATCH] fix flaky test --- .../src/main/java/JasyncConnectionFactory.kt | 2 +- .../mysql/MysqlConnectionFactoryProviderTest.kt | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/r2dbc-mysql/src/main/java/JasyncConnectionFactory.kt b/r2dbc-mysql/src/main/java/JasyncConnectionFactory.kt index 55a7e835..3b7a8300 100644 --- a/r2dbc-mysql/src/main/java/JasyncConnectionFactory.kt +++ b/r2dbc-mysql/src/main/java/JasyncConnectionFactory.kt @@ -8,7 +8,7 @@ import org.reactivestreams.Publisher import reactor.core.publisher.Mono import reactor.kotlin.core.publisher.toMono -class JasyncConnectionFactory(private val mySQLConnectionFactory: MySQLConnectionFactory) : ConnectionFactory { +class JasyncConnectionFactory(val mySQLConnectionFactory: MySQLConnectionFactory) : ConnectionFactory { override fun create(): Publisher { return Mono.defer { mySQLConnectionFactory.create().toMono().map { JasyncClientConnection(it, mySQLConnectionFactory) } } diff --git a/r2dbc-mysql/src/test/java/com/github/jasync/r2dbc/mysql/MysqlConnectionFactoryProviderTest.kt b/r2dbc-mysql/src/test/java/com/github/jasync/r2dbc/mysql/MysqlConnectionFactoryProviderTest.kt index 8a7f8324..f44e3dc1 100644 --- a/r2dbc-mysql/src/test/java/com/github/jasync/r2dbc/mysql/MysqlConnectionFactoryProviderTest.kt +++ b/r2dbc-mysql/src/test/java/com/github/jasync/r2dbc/mysql/MysqlConnectionFactoryProviderTest.kt @@ -1,31 +1,24 @@ package com.github.jasync.r2dbc.mysql import com.github.jasync.sql.db.SSLConfiguration -import io.mockk.every -import io.mockk.mockkObject -import io.mockk.verify import io.r2dbc.spi.ConnectionFactoryOptions +import org.junit.Assert.assertEquals import org.junit.Test -internal class MysqlConnectionFactoryProviderTest { +class MysqlConnectionFactoryProviderTest { private val provider = MysqlConnectionFactoryProvider() @Test fun shouldCreateMysqlConnectionWithMysqlSSLConfigurationFactory() { - // given - mockkObject(MysqlSSLConfigurationFactory) - every { MysqlSSLConfigurationFactory.create(any()) } returns SSLConfiguration() val options = ConnectionFactoryOptions.parse("r2dbc:mysql://user@host:443/") // when - provider.create(options) + val result = provider.create(options) // then - verify { - MysqlSSLConfigurationFactory.create(options) - } + assertEquals(SSLConfiguration(), result.mySQLConnectionFactory.configuration.ssl) } }