Skip to content

Commit

Permalink
fixes in base test class
Browse files Browse the repository at this point in the history
  • Loading branch information
mrehan27 committed Sep 18, 2023
1 parent 073ad7d commit 17a8e0e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions common-test/src/main/java/io/customer/commontest/BaseTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ abstract class BaseTest {
}
cioConfig.trackingApiUrl = mockWebServer.url("/").toString()
if (!cioConfig.trackingApiUrl!!.contains("localhost")) {
throw RuntimeException("server didn't' start ${cioConfig.trackingApiUrl}")
throw RuntimeException("server didn't start ${cioConfig.trackingApiUrl}")
}

// Create any stubs or mocks here
Expand Down Expand Up @@ -138,18 +138,20 @@ abstract class BaseTest {

/**
* Creates a new instance for SDK builder with default configuration for tests.
*
* @param cioConfig Optional. If provided, will override the default SDK configuration.
* The value may only be needed if the test needs to override the default SDK configuration.
*/
protected fun getCustomerIOBuilder(
cioConfig: CustomerIOConfig = createConfig(),
cioConfig: CustomerIOConfig? = null,
siteId: String = this.siteId,
apiKey: String = String.random,
region: Region = Region.US,
application: Application = this.application
): CustomerIO.Builder {
setup(cioConfig = cioConfig)
cioConfig?.let { config -> setup(cioConfig = config) }
// Initialize the SDK but with an injected DI graph.
// Test setup should prefer using the same SDK initialization that customers do to
// make test as close to production environment as possible.
// Test setup should prefer using the same SDK initialization that customers do to make test as close to production environment as possible.
return CustomerIO.Builder(
siteId = siteId,
apiKey = apiKey,
Expand Down

0 comments on commit 17a8e0e

Please sign in to comment.